hawkxu / jrviewer-fx

jrviewer-fx is a Jasper report viewer written completely in JavaFX
Eclipse Public License 1.0
20 stars 11 forks source link

Different margins #3

Open danielpeintner opened 6 years ago

danielpeintner commented 6 years ago

Hi,

First of all thanks for your work!

Using your Jasper report viewer I am running in an issue which is rather strange. Previewing a report works fine and it looks as expected. Saving it as PDF works also fine.

However, when printing (to a real printer and/or to a PDF printer) causes the margins be different meaning that the layout goes far beyond the actual paper size on the right. Did you ever experience this behavior?

Thanks,

-- Daniel

hawkxu commented 5 years ago

Hi,

Thank you for using jrviewer-fx and give me response.

Have you tried printing directly using JasperReports library rather than jrviewer-fx?

I guess the diffrence was coming from JasperReports, please make a try.

Thanks!

danielpeintner commented 5 years ago

Hi,

Printing directly or with the default JasperReports Swing previewer works just fine.

-- Daniel

hawkxu commented 5 years ago

Hi,

Printing directly or with the default JasperReports Swing previewer works just fine.

-- Daniel

the jrviewer-fx just preview the report, and do not change any settings of the report ( except merge functions), I had no clue about this problem, please send me the report file if possible, thanks!

danielpeintner commented 5 years ago

Thanks for your reply.

In the meanwhile I am using another solution. However, I will try to provide a test so that you can look into the issue... I hope I manage to do so since I am very busy at the moment.

niwesph commented 4 years ago

Dear hawkxu, I have the same issue as danielpeintner, export method work completely as first attached pdf file, jrviewer-fx print preview show correcty on screen but on printer it's margin was shipped to the right beyond the A4 paper size

These below lines is the header part of .jrxml which I use A4's page size with leftMargin="20" and rightMargin="20"

<?xml version="1.0" encoding="UTF-8"?>

------------------------------------------------------------------------------ attached file 1:------ [dialogExport2.pdf](https://github.com/hawkxu/jrviewer-fx/files/4009224/dialogExport2.pdf) attached file2 :------ ![IMG20191230142559](https://user-images.githubusercontent.com/39264893/71573046-745fd800-2b14-11ea-8dbe-72ce5ea3564e.jpg) --- Niwesph ---
thejavaprogrammerhrishav commented 4 years ago

Dear hawkxu, I have the same issue as danielpeintner, save or export works completely fine But when I try to directly print using jrviewer-fx, the left and top margins gets shifted (extra margins gets added) I also tried with the default swing JasperViewer, it works very good in all cases and it has no issues with printing

After a bit of research I found that, JasperViewer being implemented using swing uses AWT Printer API which internally uses a setImagableArea() method that sets the default page margins to 0 or in other words sets the starting coordinate to (0,0)

If anything is available in Javafx Printer API....

Please Help me...

nerd-king commented 3 years ago

I submitted a PR that fixes this issue. Not sure if the author is still around and willing to merge it in, if not feel free to check out the change, it's just a simple change that eliminates the duplicate margins.