PDF Export color change and formatting differences that truncate data

PDF Export color change and formatting differences that truncate data

REJISREJIS Posts: 15Questions: 4Answers: 0


Hopefully the images upload, but my testers reported an issue to me today that PDF export was now truncating data. I've attached what the print preview looked like before and after now. Before has the blue header and everything fit within the page bounds. Now it looks like it is just grabbing the print output and generating a PDF which drops the header color and everything is bigger and cropped off the page.

Is there a default I can change to make it render the old way? I don't care so much about the color change as they can just get over it, but the truncated data is a show stopper.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,374Questions: 26Answers: 4,957

    What changed between the before and after?

    Did you use the customize option of the PDF button to set the background of the header?

    Can you post a link to a test case replicating the issue?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • REJISREJIS Posts: 15Questions: 4Answers: 0

    Only thing that changed was going from DataTables 1 to DataTables 2. The examples for the PDF button here show bigger and no blue now as well. They have less data though. Nothing changed in the data of table definitions.

  • allanallan Posts: 63,569Questions: 1Answers: 10,481 Site admin

    Now it looks like it is just grabbing the print output and generating a PDF which drops the header color and everything is bigger and cropped off the page.

    It doesn't. it still uses pdfmake as it did before, but with Buttons 3 (or thereabouts) I updated the PDF default export to look a bit more like the print view. It would be so much easier if it were possible to just grab the print view!

    One change that might cause what you are seeing, is that it will check to see if LETTER or A4 sizing should be used based on locale. Before it was always A4. You might want to change that option, as that might account for the difference?

    Allan

  • REJISREJIS Posts: 15Questions: 4Answers: 0
    edited October 16

    No customize is used. We have orientation portrait with pageSize LETTER, and we use a title, messageBottom, and messageTop. The two messages look the same, but the titles are slightly different sizes too.

  • REJISREJIS Posts: 15Questions: 4Answers: 0
    edited October 16

    Hmm. Well, I tried setting LETTER to A4, but since A4 is smaller it just chopped off about 3 more chars now. There must have been some type of size adjusting that happened to keep things within the page. I use PDF Make tons of places for other reports and labels, and it is crazy getting things to fit at times. I have to make sort of a wrapper class that tracks how many points are in any given page size and adjust margins tracking how many points are available. I even make custom table layouts just so I know exactly how many points something is since you have to track the size of every border and margin in calculations.

  • allanallan Posts: 63,569Questions: 1Answers: 10,481 Site admin
    Answer ✓

    I certainly changed the styles a little for the export as you'll see for the header. But I'm struggling to see where I would have caused the table to take more width.

    Are you able to email me the new and the old pdfs perhaps? allan at this domain will come to me.

    Thanks,
    Allan

  • REJISREJIS Posts: 15Questions: 4Answers: 0

    The Team just decided to make it landscape, and it fits again. I combed through all kinds of stuff including the DataTable code for it and the doc templates used. The methods are like 95% the same and the doc definition is mostly color changes that also moved into styles more instead of inline, and switching from their generic noBorders to your own layout. I saw nothing wrong with it...only thing I found odd was the footer getting set to true for it didn't show my footer like it did on print, so no default was needed to hide it again so far.

    It is dynamic data in the table, so likely certain combination of text wrap different. I think the only way to improve it would be calculating the widths...or at least percentages of the table cells and making them fit within the page letting things just wrap. It can be a pain I know. I usually have to design labels and getting things lining up with 1 pixel/point messing things up is so annoying. Browsers and PDF readers keep wanting to default to shrink to fit too which messes up all my calculations.

    Thank You for all the help.

Sign In or Register to comment.