How can I convert MS Word document to accessible PDF Ua?
Untuk membuat fail PDF/UA yang boleh diakses daripada dokumen Word, anda perlu memberitahu penukar tahap pematuhan PDF‑UA yang hendak digunakan.
Dalam versi 26.5.0 Wordize untuk .NET ini dilakukan dengan sifat PdfSaveOptions.Compliance dan enumerasi PdfCompliance.
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.Compliance = PdfCompliance.PdfUa2; // PDF/UA‑2 (ISO 14289‑2:2024)
Converter.Create()
.From(MyDir + "Simple.docx")
.To(ArtifactsDir + "AccessibleDocument.pdf", pdfSaveOptions)
.Execute();
- Nilai
PdfCompliance.PdfUa2menjadikan fail output mematuhi standard PDF/UA‑2, yang mendefinisikan bagaimana PDF harus disusun supaya dapat diakses. PdfSaveOptionsialah kelas yang menyimpan pilihan penukaran, termasuk tahap pematuhan.
Rujukan
To create an accessible PDF / UA file from a Word document you need to tell the converter which PDF‑UA compliance level to use.
In the 26.5.0 version of Wordize for .NET this is done with the PdfSaveOptions.Compliance property:
- Create a
PdfSaveOptionsinstance. - Set its
Complianceto the desired PDF‑UA enum value (PdfUa1for PDF/UA‑1 orPdfUa2for PDF/UA‑2). - Pass the options to the conversion call.
Example (PDF/UA‑1) – the code is taken verbatim from the API reference:
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.Compliance = PdfCompliance.PdfUa1;
Converter.Create()
.From(MyDir + "Simple.docx")
.To(ArtifactsDir + "PdfSaveOptions.Compliance.pdf", pdfSaveOptions)
.Execute();
To generate a PDF that complies with PDF/UA‑2, set Compliance = PdfCompliance.PdfUa2 (the enum value is documented in the PdfCompliance enumeration)【PdfCompliance Enum】.
Key API members
PdfSaveOptions– class that holds PDF‑specific save settings【PdfSaveOptions Class】PdfCompliance– enumeration that defines the PDF standards, includingPdfUa1andPdfUa2【PdfCompliance Enum】
References