Home General

PDF are empty or distorted

Hello,

Today I installed my software on a new client and server.
- Windows 10 Enterprise for Virtual Desktops, version 22H2 OS build 19045.2251
- Windows Server 2022 Datacenter Azure Edition, version 21H2, OS build 20348.1366

Everything works fine, except my pdf-output.
On the Client the pdf's are all empty, on the server the are very distorted .
If i do a print-preview, and then print to the pdf-printer, it is OK.

So it seems in this new environment the pdf-generation fails.
Any idea what too do ?
Does REportbuilder need some additional software to generate the pdf ?

kind regards,

Dirk Janssens.

Comments

  • edited January 2023
    Hi Dirk,

    Empty PDF files are generally caused by a corruption of the PDF source. The main reason we see this is when the Delphi FormatSettings are changed without syncing the ppFormatSettings. If you are changing the FormatSettings, be sure to do the same to the ppFormatSettings to solve the problem.
    uses ppUtils;

    FormatSettings.DecimalSeparator := ',';
    ppFormatSettings := FormatSettings; //add this
    Distorted PDF files can be caused by a number of reasons. How exactly are the PDF's distorted? Do you have a printer installed on your machine? While the PDF device itself does not rely on a printer, ReportBuilder does use it to make initial measurements. Installing even a file printer (PDF driver, etc.) may help the issue.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi Nico,
    Thank you for you reply.
    The strange thing is, I just got a phone call from a (old) customer where also the generated pdf's are all empty! Nothing changed (no software update). They use the software many years without problems.
    Is is maybe possible that a Windows-update causes this behaviour?

    // How exactly are the PDF's distorted?
    on server :image

    kind regards,

    Dirk Janssens.
  • Maybe this additional information helps?

    The document generated by the pdf-printer is OK and starts with :

    "
    %PDF-1.7

    4 0 obj
    (Identity)
    endobj
    5 0 obj
    (Adobe)
    endobj
    8 0 obj
    <<
    /Filter /FlateDecode
    /Length 101648
    /Type /Stream
    >>
    stream
    "

    The document generated by my application (report print to file), the empty document, starts with :
    "
    %PDF-1.7
    %€‚ƒ
    1 0 obj
    << /Creator <>
    /CreationDate <443a32303233303130363133303832382b3032273030>
    /Title <>
    /Author <>
    /Producer <5265706f72744275696c646572>
    /Keywords <>
    /Subject <> >>
    endobj
    2 0 obj
    [/PDF /Text /ImageB /ImageC /ImageI]
    endobj
    3 0 obj
    << /Type /ExtGState
    /SA true
    >>
    endobj
    5 0 obj
    << /Length 9174
    /Filter /FlateDecode
    >>
    stream
    "
  • I just did a new test:
    - latest version of ReportBuilder
    - I added the lines you suggested
    - I made a new report with only 1 label on it
    ---> The pdf is empty

    any idea??
  • Last test-results:
    It seems to depend on the (windows) user.
    They all log in on the same rdp server, so they use the exactly the same sofware.
    (We even restarted the server to make sure averything is exact the same. )

    user A,B ==> all fine

    users C,D ==> all pdfs are empty

    user C is an old profile with adminstrator rights, has worked for years.
    user D is a new profile,
    user A,B : old profiles, small differences, no problems fo years.

    Where should I start ??
  • edited January 2023
    Hi Dirk,

    Please send the empty PDF file to me so I can see what is happening. If you could export the PDF with the compression set to clNone, that would be helpful.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2023
    Hi Nico,
    which emailadres should I use?
    kind regards

    Dirk

    ps : it is even getting stranger: I now have 2 pdf's opened in Notepad the *only* difference is creation/CreationDate
    If I open them in Chroome: the first is empty, the second one shows label.
    he first generated by client, the second by myselve...
    voodoo-magic!!??!
  • maybe I have something:
    If I open the files in Notepad++ i do see some differences:
    For example, the line "9 0 obj ["

    The empty PDF: 750.0 750.0 278.0 278.0 355.0 556.0 556 .....
    The other : 750,0 750,0 278,0 278,0 355,0 556,0 556, .....

    It looks like the value-seperator of that line is different. Could tha be a Windows-setting, and responsible for the corruption maybe ??
  • SOLVED!
    --> switching the region-settings of the user to Dutch solved it,
    BUT
    HOw is this possible all of the sudden??
    This was never a problem, and the software did not change! Any ideas ??

    kind regards,

    Dirk Janssens
  • Hi Dirk,

    The issue is the FormatSettings. This is the only reason this behavior will occur. Somewhere (or multiple places) in your code you are manually changing the DecimalSeparator. After this is done, you need to be sure to perform the same task for the RB ppFormatSettings as I mentioned in my first response. Do a find-in-files for the following line of code.

    "FormatSettings.DecimalSeparator :="

    and add the following line of code below it:

    ppFormatSettings := FormatSettings;
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2023
    Thank you for your respons. I added that line of code before the line "report.print", and that did not help.

    Maybe that is too late? Should I add that line of code before or right after loading the report template?

    I will do some more testing and let you know the results..

    kind regards,
    Dirk
  • Hi Nico,
    I added the code before loading the report, and also in the routine where I set some pdf-settings, and now it works fine!
    Thank you for your help,
    kind regards,
    Dirk
  • I have the same problem with empty PDF's. I have added the "ppFormatSettings := FormatSettings;" solution and check if it works for me too.

    I have another question, my application stores pdf file in a database and some of them are empty. Is there a way of knowing if these pdfs are empty or not. As far as i can see the file sizes are normal. Can I fix them by replacing some data in the pdf files?
  • Hi Bora,

    Unfortunately, no. The PDF files are not "empty", they simply have the commas (,) and periods (.) swapped.

    In a perfect (non-encoded, non-compressed, non-encrypted) world, it may be possible to perform a find/replace on these files and get a valid PDF, however it is unlikely your saved PDF files used none of the above.

    You will likely need to regenerate each invalid PDF.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.