PDF printing garbled problem

Source: Internet
Author: User

Problem:

Using Adobe Reader to output a PDF file through my virtual printer (the output is an intermediate file equivalent to an EMF file), when viewed, it is sometimes garbled. The simplest must-have-be-present steps:

1. Open the pdf file using Adobe Reader, select my Virtual printer print (uncheck "Print as image" in the Adobe Print Advanced option) to generate intermediate files.

2. This intermediate file (EMF) can be viewed by tool at this time, and found not garbled.

3. Close the pdf file of the Adobe Reader that you just printed, and look at the intermediate file again, it's garbled.

Analysis:

Based on the required steps above, re-test using Foxitreader, jisupdf open PDF file and then select my virtual printer printing, none is reproduced. In addition, after the intermediate file is generated, even if you re-open the PDF with Adobe Reader, it is still garbled when you view the intermediate file.

Based on the above phenomenon, the difference between using jisupdf and Adobe Reader to produce intermediate files after printing has been found to be quite different. Guessing that Adobe Reader has created temporary font files for non-existent fonts when printed out, so Adobe Reader does not garbled when it is closed and deletes temporary files as soon as it is closed, so it is garbled.

For example, the first time I output a Chinese file A, do not close Adobe Reader, see a normal. Turn off Adobe Reader view a garbled, open Adobe Reader again and print out B, see a garbled, b not garbled. This indicates that the temporary font file that was created is also associated with the corresponding intermediate file, not all of them.

I compare the above content of a and B separately, found that one of the differences is that the EMR_EXTCREATEFONTINDIRECTW structure of the field is not the same, and there is a more obvious field content lffacename different.

Looking at the introduction to EMR_EXTCREATEFONTINDIRECTW on MSDN, it's almost certain that Adobe Reader created a temporary font file when the PDF file was printed out, so once the Adobe Reader process is closed, Deleting a temporary font file causes the intermediate file to be garbled. This also explains why the direct output to the printer does not, and through my virtual printer output intermediate files, if the same machine does not close the Adobe Reader process when the intermediate file output to the real printer will not garbled, and on the other machine output will be garbled.

To confirm this problem, I used jisupdf and foxitreader to print out the intermediate files C and D respectively. By comparing A and C, a and D, it is found that extcreatefontindirectw is absent in both C and D, thus proving the above conclusion.

In other words, I use a non-inline and system-not-installed font in this PDF file , and the PDF reader uses the relevant font to replace the display when it is opened.

Further analysis:

Now the question turns out, why does Adobe Reader call CreateFontIndirect (Generate EXTCREATEFONTINDIRECTW Records) while printing, while Jisupdf and Foxitreader don't?

In addition, if there are EXTCREATEFONTINDIRECTW records in the generated EMF, how can I create a desired font based on this record so that it does not display garbled characters?

Through the analysis of the records in the EMF to draw, found that it can be called createfontindirect function to implement the EXTCREATEFONTINDIRECTW record, but still garbled, that is, can not find the actual match on the font.

PDF printing garbled problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.