WriteAllPages() публичный Метод

public WriteAllPages ( ) : void
Результат void
Пример #1
0
        protected void AddSharedObjectsToBody()
        {
            // add the fonts
            foreach (FontDetails details in documentFonts.Values) {
                details.WriteFont(this);
            }
            // add the form XObjects
            foreach (Object[] objs in formXObjects.Values) {
                PdfTemplate template = (PdfTemplate)objs[1];
                if (template != null && template.IndirectReference is PRIndirectReference)
                    continue;
                if (template != null && template.Type == PdfTemplate.TYPE_TEMPLATE) {
                    AddToBody(template.GetFormXObject(compressionLevel), template.IndirectReference);
                }
            }
            // add all the dependencies in the imported pages
            foreach (PdfReaderInstance rd in readerInstances.Values) {
                currentPdfReaderInstance = rd;
                currentPdfReaderInstance.WriteAllPages();
            }
            currentPdfReaderInstance = null;
            // add the color
            foreach (ColorDetails color in documentColors.Values) {
                AddToBody(color.GetSpotColor(this), color.IndirectReference);
            }
            // add the pattern
            foreach (PdfPatternPainter pat in documentPatterns.Keys) {
                AddToBody(pat.GetPattern(compressionLevel), pat.IndirectReference);
            }
            // add the shading patterns
            foreach (PdfShadingPattern shadingPattern in documentShadingPatterns.Keys) {
                shadingPattern.AddToBody();
            }
            // add the shadings
            foreach (PdfShading shading in documentShadings.Keys) {
                shading.AddToBody();
            }
            // add the extgstate
            foreach (KeyValuePair<PdfDictionary, PdfObject[]> entry in documentExtGState) {
                PdfDictionary gstate = entry.Key;
                PdfObject[] obj = entry.Value;
                AddToBody(gstate, (PdfIndirectReference)obj[1]);
            }

            // add the properties
            foreach (KeyValuePair<Object, PdfObject[]> entry in documentProperties) {
                Object prop = entry.Key;
                PdfObject[] obj = entry.Value;
                if (prop is PdfLayerMembership){
                    PdfLayerMembership layer = (PdfLayerMembership)prop;
                    AddToBody(layer.PdfObject, layer.Ref);
                }
                else if ((prop is PdfDictionary) && !(prop is PdfLayer)){
                    AddToBody((PdfDictionary)prop, (PdfIndirectReference)obj[1]);
                }
            }
        }
Пример #2
0
 /** Writes the reader to the document and frees the memory used by it.
 * The main use is when concatenating multiple documents to keep the
 * memory usage restricted to the current appending document.
 * @param reader the <CODE>PdfReader</CODE> to free
 * @throws IOException on error
 */
 public virtual void FreeReader(PdfReader reader)
 {
     currentPdfReaderInstance = (PdfReaderInstance)importedPages[reader];
     if (currentPdfReaderInstance == null)
         return;
     currentPdfReaderInstance.WriteAllPages();
     currentPdfReaderInstance = null;
     importedPages.Remove(reader);
 }