PDFATest.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using ComPDFKit.PDFDocument;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace PDFATest
  9. {
  10. internal class PDFATest
  11. {
  12. private static string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\PDFA";
  13. public static bool CovertToPDFA(CPDFDocument document)
  14. {
  15. string convertToPDFAPath = outputPath + "\\ConvertToPDFATest.pdf";
  16. document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFAPath);
  17. return true;
  18. }
  19. public static bool CovertToPDFA1b(CPDFDocument document)
  20. {
  21. string convertToPDFA1bPath = outputPath + "\\ConvertToPDFA1bTest.pdf";
  22. document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFA1bPath);
  23. return false;
  24. }
  25. static void Main(string[] args)
  26. {
  27. Console.WriteLine("Running PDFA test sample…\r\n");
  28. SDKLicenseHelper.LicenseVerify();
  29. CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
  30. if (!Directory.Exists(outputPath))
  31. {
  32. Directory.CreateDirectory(outputPath);
  33. }
  34. CovertToPDFA(document);
  35. CovertToPDFA1b(document);
  36. }
  37. }
  38. }