This is my code:
Code:
private void Test(string src, string dst)
{
PdfDocument outputDocument = new PdfDocument();
outputDocument.PageLayout = PdfPageLayout.SinglePage;
XPdfForm form = XPdfForm.FromFile(src);
for (form.PageIndex = 0; form.PageIndex < form.PageCount; form.PageIndex++)
{
PdfPage page = outputDocument.AddPage();
page.Orientation = PageOrientation.Portrait;
page.Width = form.Page.Width;
page.Height = form.Page.Height;
//DrawInfo(page, form.PageCount, form.PageNumber);
using (var gfx = XGraphics.FromPdfPage(page))
{
gfx.DrawImage(form, 0, 0);
}
}
outputDocument.Save(dst);
}
When the original PDF file is generated by Illustrator CS6 and there are hidden layers, pdfsharp draws the contents of hidden layers together.
Attachments can't upload PDF, so I uploaded screenshots.
-------------------------------------------------------------
Attachment:
image.png [ 8.8 KiB | Viewed 6978 times ]
-------------------------------------------------------------
This is the PDF file:http://www.ul.to/4jqlpdjg