Forum Replies Created
-
AuthorPosts
-
in reply to: Technical questions / Troubleshooting June 6, 2025 at 17:29#39644
Hi.
I try to generate a pdf document.
We need to setup a background image – this is the company letter paper. I did this and this works fine.Now we have the problem each paper has an footer. In the footer their are informations like page, date or something else. If i generate the pdf with background all looks perfect as pdf. But if i render without background and print that, the positions of the informations are not exactly and the data is not at the correct position.
Now I am looking where i could do the mistake.
Here a little bit code, but it is in scala.
def setPaper(formatName: String, overrideWidthInMM: Int = 0, overrideHeightInMM: Int = 0): Unit = { formatName.toUpperCase match { case "A3" => pd4ml.setPageSize(PageSize.A3) pd4ml.setHtmlWidth(PD4Constants.A3.width) case "A4" => pd4ml.setPageSize(PageSize.A4) pd4ml.setHtmlWidth(ptToPx(PD4Constants.A4.width).toInt) case "A5" => pd4ml.setPageSize(PageSize.A5) pd4ml.setHtmlWidth(ptToPx(PD4Constants.A5.width).toInt) case "A6" => pd4ml.setPageSize(PageSize.A6) pd4ml.setHtmlWidth(ptToPx(PD4Constants.A6.width).toInt) case _ => pd4ml.setPageSize(new PageSize(overrideWidthInMM.toFloat,overrideHeightInMM.toFloat,Units.MM)) pd4ml.setHtmlWidth(ptToPx(mmToPt(overrideWidthInMM)).toInt) } }
the mmToPt an ptToPx is here
def mmToPt(mm: Double): Double = { PD4ML.translateToPt(mm.toFloat) } def ptToPx(pt: Double): Double = { pt*1.333 }
The old version takes at mmToPt: mm*2.8346456693
I think the setHtmlWidth needs all in px. I hope that is correct.
Also i am using this pd4ml.protectPhysicalUnitDimensions(true)
Is their something wrong?
-
AuthorPosts