You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Olaf Krueger <po...@olafkrueger.net> on 2017/08/11 08:48:52 UTC

Re: FlexPrintJobScaleType doesn't work for me

Hi Alex,
sorry for the late response, I've overlooked your post.
It seems to me that sometimes mails from the list doesn't reach my local
inbox for whatever reason.

>What are you printing?
I am trying to print a s:Group that contains several Spark components
including a Timebar component that comes from Ardisialibs as an external
vendor.


>Debug into addObject and watch the size computation. 
I found that the print job splits the content into a multiple number of
pages if it does not fit the size of the page .
I thought the print job was able to scale the content automatically by using
e.g. 'FlexPrintJobScaleType.FILL_PAGE' to fit the page?
Do I have to scale it by myself before printing?

I've one more issue with transparent components.
If the alpha of a component is <1 that the print job just outputs a black
area.
It seems to me that this is a known issue.
Is there a workaround for this?

Thanks,
Olaf





--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexPrintJobScaleType-doesn-t-work-for-me-tp15482p15708.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: FlexPrintJobScaleType doesn't work for me

Posted by Olaf Krueger <po...@olafkrueger.net>.
>Did you try playing with the printAsBitmap options? 

Yes, with no success... but maybe I miss something.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexPrintJobScaleType-doesn-t-work-for-me-tp15482p15726.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: FlexPrintJobScaleType doesn't work for me

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Did you try playing with the printAsBitmap options?

-Alex

On 8/11/17, 1:51 PM, "Olaf Krueger" <po...@olafkrueger.net> wrote:

>Thanks Alex, I'll take a look at it soon!
>
>>Regarding alpha, I think if the thing you print has alpha < 0, you
>>actually want to print the parent of that thing.
>
>Mhhh... there's a transparent rectangle on top which has an alpha <1.
>I just would like to print exactly the same that is on the screen.
>But this transparent rectangle is printed as a black rectangle so the
>underlying content is hidden [1].
>
>Thanks,
>Olaf 
>
>[1] 
>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsnag.gy%2
>FOryeiA.jpg&data=02%7C01%7C%7Cd7d246ae8c594eb858b708d4e0fae420%7Cfa7b1b5a7
>b34438794aed2c178decee1%7C0%7C0%7C636380815559561986&sdata=51iyja3%2B5t19S
>%2BESAazER4hTHFGRYR%2F3%2F%2FlBj1uCOQg%3D&reserved=0
>
>
>
>--
>View this message in context:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-users.2333346.n4.nabble.com%2FFlexPrintJobScaleType-doesn-t-work-for-me-
>tp15482p15718.html&data=02%7C01%7C%7Cd7d246ae8c594eb858b708d4e0fae420%7Cfa
>7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636380815559561986&sdata=Mryzi5dH
>FCjAdN2LasldixCeoJX7R9nF0a2PxMI0ssg%3D&reserved=0
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: FlexPrintJobScaleType doesn't work for me

Posted by Olaf Krueger <po...@olafkrueger.net>.
I did it as you suggested and create a PDF on the server side instead of
using FlexPrintJob now.

To achieve this I've introduced a new endpoint to my server side API that
expects an image and some metadata. The services scale the image, create a
PDF and returns an url to the created PDF.
Maybe it makes more sense to scale the image at client side...

To be able to pass the image within some meta data via JSON I've encoded the
image as base64.
(This means that the payload increases at approximately 30%, but this no
issue here).

I've created a gist [1], maybe it is helpful for others.

Thanks for the help!

Olaf

[1] https://gist.github.com/ok-at-github/17eaa04e7025f2b34ca23774119e4e39







--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexPrintJobScaleType-doesn-t-work-for-me-tp15482p15750.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: FlexPrintJobScaleType doesn't work for me

Posted by doug777 <do...@gmail.com>.
We have tried to use FlexPrintJob in the past with or without printAsBitmap
set. But we found the final print usually has odd artefacts included just as
you are seeing. Unless you have a fairly simple document and you know it
will never be more than one page long, I would suggest these alternatives.

** And of course this is the great beauty of Flex - it's fle-e-ex-ible!

Option 1 : Wrap up your document in the simplest DataGrid you can devise and
then use PrintDataGrid. This works well but you may need to paginate
manually and put the pages in different rows otherwise single lines of text
can get split through the middle.

Option 2 (which is my current preference) : When user clicks Print, send the
doc to a pdf creator on the server and return the url of the saved pdf. On
receipt of url, spawn Adobe Reader so that the user can print with the
superb print interface in Adobe Reader.

At first sight this appears a 'clunky' solution, but users quickly
appreciate the sheer power of the Adobe Printer and the output is always
perfect no matter what you throw at it.

Hope this helps,
Doug




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexPrintJobScaleType-doesn-t-work-for-me-tp15482p15722.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: FlexPrintJobScaleType doesn't work for me

Posted by Olaf Krueger <po...@olafkrueger.net>.
Thanks Alex, I'll take a look at it soon!

>Regarding alpha, I think if the thing you print has alpha < 0, you 
>actually want to print the parent of that thing. 

Mhhh... there's a transparent rectangle on top which has an alpha <1.
I just would like to print exactly the same that is on the screen.
But this transparent rectangle is printed as a black rectangle so the
underlying content is hidden [1].

Thanks,
Olaf 

[1] https://snag.gy/OryeiA.jpg



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexPrintJobScaleType-doesn-t-work-for-me-tp15482p15718.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: FlexPrintJobScaleType doesn't work for me

Posted by Alex Harui <ah...@adobe.com.INVALID>.
In looking at the source for FlexPrintJob, if the thing you are printing
isn't the main app, then the currently size of the thing is used to
compute how to scale to fill the page, but after that, validateNow() is
called.  If the thing you print computes to a different size that is too
large for the page then it will split the page.   So step into it again
and watch how the width/height is computed and handled and see if it
changes on the validateNow() calls.

Regarding alpha, I think if the thing you print has alpha < 0, you
actually want to print the parent of that thing.

HTH,
-Alex

On 8/11/17, 1:48 AM, "Olaf Krueger" <po...@olafkrueger.net> wrote:

>Hi Alex,
>sorry for the late response, I've overlooked your post.
>It seems to me that sometimes mails from the list doesn't reach my local
>inbox for whatever reason.
>
>>What are you printing?
>I am trying to print a s:Group that contains several Spark components
>including a Timebar component that comes from Ardisialibs as an external
>vendor.
>
>
>>Debug into addObject and watch the size computation.
>I found that the print job splits the content into a multiple number of
>pages if it does not fit the size of the page .
>I thought the print job was able to scale the content automatically by
>using
>e.g. 'FlexPrintJobScaleType.FILL_PAGE' to fit the page?
>Do I have to scale it by myself before printing?
>
>I've one more issue with transparent components.
>If the alpha of a component is <1 that the print job just outputs a black
>area.
>It seems to me that this is a known issue.
>Is there a workaround for this?
>
>Thanks,
>Olaf
>
>
>
>
>
>--
>View this message in context:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-users.2333346.n4.nabble.com%2FFlexPrintJobScaleType-doesn-t-work-for-me-
>tp15482p15708.html&data=02%7C01%7C%7C5511785d3b644b4d03fa08d4e095ffa7%7Cfa
>7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636380382230870648&sdata=WUxoJjRw
>ZC86c%2BQPPQ1Tg7PZMKApW7cGsIpAFjaYxTk%3D&reserved=0
>Sent from the Apache Flex Users mailing list archive at Nabble.com.