PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

PdfPage Reference
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1997
Page 1 of 1

Author:  wasabi [ Thu Apr 26, 2012 10:37 pm ]
Post subject:  PdfPage Reference

I am adding a new PdfDictionary to Catalog, which has an element with direct value of a PdfArray. Each member of the PdfArray is a iref to a PdfPage. So, I'm adding a custom array of pointers to pages.

This works fine, and saves fine... but when I reload the document, my PdfArray is full of PdfDictionaries: which appear to be COPIES of the original PdfPages. PdfDictionarys with /Content, and the whole nine yards.

I'm not sure if this is a bug during load, or a bug during save, or my issue with no adding the indirect page references correctly somehow.

Author:  wasabi [ Thu Apr 26, 2012 10:56 pm ]
Post subject:  Re: PdfPage Reference

Solved this. I do consider it a PdfSharp bug. If you access the iref for a page through something other than .Pages, it instantiates it as a PdfDictionary. I added the following code before my code to fix it:


// pre-load page instances to prevent instantiation as raw dictionaries
foreach (PdfSharp.Pdf.PdfPage page in pdf.Pages)
continue;

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/