Rank: Newbie
Groups: Registered
Joined: 2/16/2016(UTC) Posts: 1 
|
Hi, I am trying to print a simple PDF page to the printer. It printed 5mm off from the top and 5mm from left. The same PDF file was printed correctly with Adobe Reader, Foxit Reader, etc. I have try OriginAtMargins but no effect. Here is the test code: Code:
public void PrintDocument(PdfDocument pdf)
{
PrintDocument pd = new PrintDocument();
int pageForPrint = 0;
pd.PrintPage += (s, e) =>
{
pd.PrinterSettings.FromPage = 1;
pd.PrinterSettings.ToPage = 1;
e.PageSettings.PaperSize.RawKind = (int)PaperKind.Letter;
e.PageSettings.Landscape = false;
pd.OriginAtMargins = true;
e.PageSettings.Margins.Top = 0;
e.PageSettings.Margins.Left = 0;
e.PageSettings.Margins.Bottom = 0;
e.PageSettings.Margins.Right = 0;
int actualWidth = (int)(e.Graphics.DpiX * 8.5f);
int actualHeight = (int)(e.Graphics.DpiY * 11);
pdf.Pages[pageForPrint].Render
(e.Graphics,
0,
0,
actualWidth,
actualHeight,
Patagames.Pdf.Enums.PageRotate.Normal, Patagames.Pdf.Enums.RenderFlags.FPDF_PRINTING);
if (pageForPrint < pdf.Pages.Count - 1)
{
pageForPrint++;
e.HasMorePages = true;
}
};
pd.Print();
}
}
}
Thanks. Edited by moderator 9 years ago
| Reason: [code=cs]
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,116
Thanks: 8 times Was thanked: 130 time(s) in 127 post(s)
|
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close