i've apply hotfix but it doesn't solve my problem.
i just copied bunch of dll and add 'pdoc.PageSettings.Margins.All = 0;' on my constructor.
but still output is same as before.
after few attempt, i found source of problem.
i've restrict a region on my image and set specific location something like this
- Code: Select all
PdfDocument pdoc = new PdfDocument();
pdoc.PageSettings.Margins.All = 0;
PdfPageBase pgb = pdoc.Pages.Add(new System.Drawing.SizeF(842f,595f));
PdfImage pdf_image = PdfImage.FromFile("img_source.png");
PdfTemplate pdf_template2 = new PdfTemplate(731.186462f, 539.25f);
pdf_template2.Graphics.DrawImage(pdf_image,new System.Drawing.RectangleF(0,0, 731.186462f, 539.25f));
pdf_template2.Graphics.Flush();
pgb.Canvas.DrawTemplate(pdf_template2, new System.Drawing.PointF(55.15678f, 27.75f));
pdoc.SaveToFile("save.pdf",FileFormat.PDF);
but as you can see, it didn't work properly.
so i try modifiy my source a little bit
- Code: Select all
PdfPageBase pgb = pdoc.Pages.Add(new System.Drawing.SizeF(842f, 595f));
PdfImage pdf_image = PdfImage.FromFile("img_source.png");
PdfTemplate pdf_template2 = new PdfTemplate(731.186462f + 55.15678f, 539.25f + 27.75f);
pdf_template2.Graphics.DrawImage(pdf_image, new System.Drawing.RectangleF(55.15678f, 0, 731.186462f, 539.25f));
pdf_template2.Graphics.Flush();
pgb.Canvas.DrawTemplate(pdf_template2, new System.Drawing.PointF(0, 27.75f));
pdoc.SaveToFile("save.pdf", FileFormat.PDF);
but i think this approach isn't right.
for your information, i've add image source.
let me know if i was wrong or need to be update.
i'm really grateful your effort. thank you.
Login to view the files attached to this post.