PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 9:40 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Sep 14, 2009 1:09 pm 
Offline

Joined: Mon Sep 14, 2009 6:45 am
Posts: 1
I am creating a pdf by adding an external template image (420x297 mm [A3 landscape]) to a new page then overwriting with data from another external page (also A3 landscape according to Acrobat file|properties). The template image works ok but the data laid over the top of it is not in the correct position - all i get is the bottom left hand corner of the data page (as if it were on a portrait orientated page). Page.Rotate is 0 on the template image page but 270 on the data page and i have tried changing combinations of .Rotate and .Orientation for both the new page and the source page but none of these rectify the problem. The TwoPagesOnOne sample was used as a guideline. All help and ideas greatly appreciated.

Code:
  //background PDF file
  stockFilename = dataPath + "Stock.pdf";
  formBackground = XPdfForm.FromFile(stockFilename);
  formBackground.PageNumber = stockIndex;

  //data PDF file
  formData = XPdfForm.FromFile(pdfListItemDataFilename);
  formData.PageNumber = dataPageNumber;

  // Create the output document
  outputDocument = new PdfDocument();
  outputDocument.PageLayout = PdfPageLayout.SinglePage;

  // Add a new page to the output document based on background (stock)
  newPage = outputDocument.AddPage();
  newPage.Orientation = formBackground.Page.Orientation;
  width = formBackground.PointWidth;
  height = formBackground.PointHeight;

  newPage.Width = width;
  newPage.Height = height;

  gfx = XGraphics.FromPdfPage(newPage);
  box = new XRect(0, 0, width, height);
  gfx.DrawImage(formBackground, box);

  //Draw data image
  gfx.DrawImage(formData, box);


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 379 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group