Rank: Newbie Groups: Member
Joined: 1/25/2012 Posts: 3
|
I'm having trouble adding text or images to existing pdf files. I am able to add text and images to new pdf pages but not to pages that were created using existing pdf files.
Note that the hcfa-1500_NoFieldOptimized.pdf is a single page pdf file with gridlines on it.
Expected Result: The image and text is written onto hcfa page and onto the new page. Actual Result: The image is not visible on the hcfa page but is visible on the new page.
======================= My code is below:
PdfDocument doc = new PdfDocument(@"C:\Development\brian.bentow\VER1_3_DOTNET3_5_Current\TestEO\hcfa-1500_NoFieldOptimized.pdf"); PdfPage page1 = doc.Pages.Add(); System.Drawing.Image image = System.Drawing.Image.FromFile(@"C:\Users\brian.bentow\Pictures\ABCHospital.jpg"); foreach (PdfPage page in doc.Pages) { PdfTextLayer textLayer = new PdfTextLayer(); textLayer.Font = new PdfFont("Verdana", 22); PdfImage pdfImage = new PdfImage(image); PdfImageContent imageContent = new PdfImageContent(pdfImage); imageContent.GfxMatrix.Translate(100, 100); imageContent.AutoScale(); page.Contents.Add(imageContent);
PdfTextContent content1 = new PdfTextContent("Test work"); content1.PositionMode = PdfTextPositionMode.Offset; content1.Offset = new PdfPoint(1, 1);
textLayer.Contents.Add(content1);
page.Contents.Add(textLayer);
}
doc.Save("test.pdf");
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Your code looks correct. Can you send us your hcfa-1500_NoFieldOptimized.pdf so that we can take a look? We will PM you as to where to send the file.
Thanks!
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We have confirmed this to be a bug and emailed you a new build that should fix this problem. Please let us know if the new build works for you.
Thanks!
|