gpt4 book ai didi

pdf - iTextSharp 可以将 PDF 文档转换为 PDF/A

转载 作者:行者123 更新时间:2023-12-04 22:04:15 31 4
gpt4 key购买 nike

我无法在 FAQ 中找到这个功能是否存在于 API 中,尽管它在书中提到作为潜在可用的东西。有没有人有任何实现此功能的经验?

最佳答案

This thread (日期为 2007 年 6 月)Paulo Soares 提供了显示对 PDF/A 支持的代码。这是 C# 代码(他还有一个 Java 示例):

private void PdfATest() {
Document doc = new Document(PageSize.A4);
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream("C:\\hello_A1-b_cs.pdf", FileMode.Create));
writer.PDFXConformance = PdfWriter.PDFA1B;
doc.Open();

PdfDictionary outi = new PdfDictionary(PdfName.OUTPUTINTENT);
outi.Put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("sRGB IEC61966-2.1"));
outi.Put(PdfName.INFO, new PdfString("sRGB IEC61966-2.1"));
outi.Put(PdfName.S, PdfName.GTS_PDFA1);

// get this file here: http://old.nabble.com/attachment/10971467/0/srgb.profile
ICC_Profile icc = ICC_Profile.GetInstance("c:\\srgb.profile");
PdfICCBased ib = new PdfICCBased(icc);
ib.Remove(PdfName.ALTERNATE);
outi.Put(PdfName.DESTOUTPUTPROFILE, writer.AddToBody(ib).IndirectReference);

writer.ExtraCatalog.Put(PdfName.OUTPUTINTENTS, new PdfArray(outi));

BaseFont bf = BaseFont.CreateFont("c:\\windows\\fonts\\arial.ttf", BaseFont.WINANSI, true);
Font f = new iTextSharp.text.Font(bf, 12);
doc.Add(new Paragraph("hello", f));

writer.CreateXmpMetadata();

doc.Close();
}

上面的链接包括 ICC_Profile 文件的下载。

关于pdf - iTextSharp 可以将 PDF 文档转换为 PDF/A,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2366851/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com