internal PdfNewDocument method_10(List <Image> A_0) { if (A_0 == null) { return(null); } int count = A_0.Count; int num2 = (count > 90) ? 3 : ((count > 60) ? 5 : ((count > 30) ? 10 : count)); this.pdfNewDocument_0 = this.method_12(); for (int i = 0; i < count; i++) { using (Image image = A_0[i]) { PdfNewPage page = this.method_14(new SizeF(image.Width * 0.75f, image.Height * 0.75f)).get_Pages().Add(); this.pdfPageBase_0 = page; using (PdfMetafile metafile = PdfImage.FromImage(image)) { metafile.set_Quality((long)this.int_0); metafile.ᜀ(page, new RectangleF(PointF.Empty, page.get_Size()), true, this.method_1().EmbeddedFontNameList, this.method_1().IsEmbeddedAllFonts); metafile.Dispose(); } image.Dispose(); } if ((i % num2) == 0) { GC.Collect(); } } return(this.pdfNewDocument_0); }
private void button1_Click(object sender, EventArgs e) { //Create a pdf document. PdfNewDocument doc = new PdfNewDocument(); // Create one page PdfPageBase page = doc.Pages.Add(); //Draw the page DrawPage(page); String pfxPath = @"..\..\..\..\..\..\Data\Demo.pfx"; PdfCertificate cert = new PdfCertificate(pfxPath, "e-iceblue"); PdfSignature signature = new PdfSignature(doc, page, cert, "demo"); signature.ContactInfo = "Harry Hu"; signature.Certificated = true; signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill; //Save pdf file. doc.Save("DigitalSignature.pdf"); doc.Close(); //Launching the Pdf file. PDFDocumentViewer("DigitalSignature.pdf"); }
private void button1_Click(object sender, EventArgs e) { //pdf file String input = @"..\..\..\..\..\..\Data\Sample5.pdf"; //open pdf document PdfDocument doc = new PdfDocument(); doc.LoadFromFile(input); PdfNewDocument newDoc = new PdfNewDocument(); newDoc.Conformance = PdfConformanceLevel.Pdf_A1B; foreach (PdfPageBase page in doc.Pages) { SizeF size = page.Size; PdfPageBase p = newDoc.Pages.Add(size, new Spire.Pdf.Graphics.PdfMargins(0)); page.CreateTemplate().Draw(p, 0, 0); } string output = "ToPDFA.pdf"; newDoc.Save(output); newDoc.Close(); //Launching the result file. PDFDocumentViewer(output); }
private void button1_Click(object sender, EventArgs e) { //Pdf file String input = @"..\..\..\..\..\..\Data\SamplePDFA.pdf"; //Open pdf document PdfDocument doc = new PdfDocument(); doc.LoadFromFile(input); //Create a new pdf and draw content on new file PdfNewDocument newDoc = new PdfNewDocument(); newDoc.CompressionLevel = PdfCompressionLevel.None; foreach (PdfPageBase page in doc.Pages) { SizeF size = page.Size; PdfPageBase p = newDoc.Pages.Add(size, new Spire.Pdf.Graphics.PdfMargins(0)); page.CreateTemplate().Draw(p, 0, 0); } string output = "PDFAToPdf-result.pdf"; newDoc.Save(output); newDoc.Close(); //Launch the Pdf file PDFDocumentViewer(output); }
void Component.Dispose(bool A_0) { base.Dispose(A_0); if (this.list_0 != null) { this.list_0.Clear(); this.list_0 = null; } this.pdfNewDocument_0 = null; this.pdfPageBase_0 = null; this.toPdfParameterList_0 = null; }
private PdfNewDocument method_26(Class195 A_0) { this.method_15(A_0); int count = A_0.method_0().Count; int num3 = (count > 90) ? 3 : ((count > 60) ? 5 : ((count > 30) ? 10 : count)); this.pdfNewDocument_0 = this.method_12(); for (int i = 0; i < count; i++) { using (MemoryStream stream = new MemoryStream()) { A_0.method_57(i, 1, ImageType.Metafile, stream, false, false, true); PdfNewPage page = this.method_13(this.method_0()[i]).get_Pages().Add(); this.pdfPageBase_0 = page; using (PdfMetafile metafile = PdfImage.FromImage(A_0.method_34().method_0()[i].method_0())) { metafile.set_Quality((long)this.int_0); metafile.ᜀ(page, new RectangleF(PointF.Empty, page.get_Size()), true, this.method_1().EmbeddedFontNameList, this.method_1().IsEmbeddedAllFonts, this.method_2()); } this.method_18(A_0.method_34().method_0()[i].method_2()); A_0.method_34().method_0()[i].method_0().Dispose(); A_0.method_34().method_0()[i].method_1(null); } if ((i % num3) == 0) { GC.Collect(); } } this.method_27(A_0, count, false); if (!this.method_1().CreateWordBookmarks) { this.method_27(A_0, count, true); } else if (A_0.method_11().Count > 0) { PdfBookmark bookmark = this.pdfNewDocument_0.get_Bookmarks().Add(this.method_1().WordBookmarksTitle); bookmark.set_Color((PdfRGBColor)this.method_1().WordBookmarksColor); bookmark.set_DisplayStyle(this.method_24(this.method_1().WordBookmarksTextStyle)); this.method_22(A_0.method_11(), bookmark); } this.method_16(A_0.method_35().BuiltinDocumentProperties); A_0.method_51(); return(this.pdfNewDocument_0); }
private PdfNewDocument method_12() { PdfNewDocument document = new PdfNewDocument(); document.(); if (this.method_1().PdfConformanceLevel != null) { document = new PdfNewDocument(this.method_1().PdfConformanceLevel); document.ᜁ(false); } else { document.get_FileStructure().set_CrossReferenceType(1); document.get_FileStructure().set_Version(5); document.ᜀ(this.method_1().PdfSecurity); } document.get_PageSettings().get_Margins().set_All(0f); return(document); }
private void button1_Click(object sender, EventArgs e) { PdfNewDocument doc = new PdfNewDocument(); //Spire.PDF supports Pdf_A1B, Pdf_X1A2001, Pdf_A1A, Pdf_A2A doc.Conformance = PdfConformanceLevel.Pdf_A1B; //Create one A4 page PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, new PdfMargins(40)); // Draw content DrawPage(page); String result = "CreatePDFA1WithSpirePDF_out.pdf"; //Save the document doc.Save(result); //Launch the Pdf file PDFDocumentViewer(result); }
private void button1_Click(object sender, EventArgs e) { //Pdf file String input = @"..\..\..\..\..\..\Data\SampleB_2.pdf"; //Open pdf document PdfDocument doc = new PdfDocument(); doc.LoadFromFile(input); PdfNewDocument newDoc = new PdfNewDocument(); //Set Pdf_A1B newDoc.Conformance = PdfConformanceLevel.Pdf_A1B; foreach (PdfPageBase page in doc.Pages) { SizeF size = page.Size; PdfPageBase p = newDoc.Pages.Add(size, new Spire.Pdf.Graphics.PdfMargins(0)); page.CreateTemplate().Draw(p, 0, 0); } //Load files and add in attachments byte[] data = File.ReadAllBytes(@"..\..\..\..\..\..\Data\SampleB_1.png"); PdfAttachment attach1 = new PdfAttachment("attachment1.png", data); byte[] data2 = File.ReadAllBytes(@"..\..\..\..\..\..\Data\SampleB_1.pdf"); PdfAttachment attach2 = new PdfAttachment("attachment2.pdf", data2); newDoc.Attachments.Add(attach1); newDoc.Attachments.Add(attach2); string output = "ToPDFAWithAttachments-result.pdf"; newDoc.Save(output); newDoc.Close(); //Launch the reuslt file PDFDocumentViewer(output); }