[cairo] Blurry page when printing pdf on windows

Juan Garcia j.garcia at m-privacy.de
Fri Jun 10 14:18:51 UTC 2016


Am 10.06.2016 um 16:06 schrieb Adrian Johnson:
> On 10/06/16 23:09, Juan Garcia wrote:
>> Hi everybody!
>>
>> First of all, thank you very much for creating such an awesome library!
>>
>> I've encountered a small problem while using it and would really
>> appreciate if you could give me a hand with it. If you find the time and
>> feel like it, of course!
>>
>> I created the following pdf
>> (eu-data-protection-authorities-demand-privacy-shield-clarification)
>> with firefox:
>>
>> https://owncloud.m-privacy.de/index.php/s/RK88qQpaUXHN5Vg
>> (password is 'save')
>>
>>
>> With some copy paste from different sources (mostly examples from your
>> page and poppler) I managed to implement a small cairo_pdfprinter.exe to
>> print pdfs with windows (I actually use the code somewhere else but I
>> created it to test and the code I am using elsewhere is exactly the same).
>>
>> Please find the source here (cairo_pdfprinter.c):
>>
>> https://owncloud.m-privacy.de/index.php/s/oY8zB0qqD5le1hd
>> (password is also 'save')
>>
>> It probably has to do with
>> cairo_surface_t* surface = cairo_win32_printing_surface_create
>> (print_dlg->hDC);
>>
>> in the do_print function.
>>
>> Most of the time it works, but with some pdfs created with certain web
>> pages with firefox it prints some of the pages blurred (normally not all
>> of them). The pdf is ok. See the attached xps which I printed with the
>> standard windows printer (this also happens with actual printers).
>>
>> Here the blurry xps example:
>> https://owncloud.m-privacy.de/index.php/s/RhisnVdNhBuwa9n
>> (password is also 'save')
>>
>> In the example, just the first page that appears blurry. I believe it
>> somehow might have to do with alpha channels and was very excited when I
>> saw there was a new version that seems to solve *exactly* my problem :)
>>
>> Unfortunately, after compiling the newest cairo (1.15.2), and
>> recompiling the example I get an error which says:
>>
>> Assertion failed!
>>
>> Program: Z:\cairo_pdfprinter.exe
>> File: cairo-recording-surface.c, Line 599
>>
>> Expression: ! surface->unbounded
>>
>> If I happen to *not* print the first page, the file *does* print.
>>
>> Am I doing something wrong here? Do you have any idea what could be wrong?
> 
> No idea. Does it work using the latest cairo git and pdftocairo? 

I am going to try that right now. With pdftocairo do you mean poppler?

> Does it
> work with a different printer eg a pdf printer? 

My cairo_pdfprinter.exe has the same result no matter what printer I use.

If I use another pdf program to print the file, then it works.

>How did you build it?

I statically cross-compiled all necessary libraries using MingW. If I
recall correctly, I didn't manage to link libtiff at the moment, but
didn't worry too much, as I thought it wouldn't be that important.

> 
>>
>> Once again, thanks for the cool software and thank you very much for
>> your help!
>>
>> Kind regards,
>> Juanito
>>
>>
> 

Thank you very much!


More information about the cairo mailing list