1

I'm trying to read a very large .AFP file and then convert it to .PDF but I can not do it, I've reached the point of getting all bytes of the file but how do I convert it to PDF.

         // Open the file.
         FileStream fs = new FileStream (szFileName, FileMode.Open);
         // Create a BinaryReader on the file.
         BinaryReader br = new BinaryReader (fs);
         // array of bytes big enough to hold the file's contents.
         Byte [] bytes = new Byte [fs.Length];
         // Your unmanaged pointer.
         IntPtr pUnmanagedBytes = new IntPtr (0);
         Int nLength;

         NLength = Convert.ToInt32 (fs.Length);
         // Read the contents of the file into the array.
         Bytes = br.ReadBytes (nLength);

Any idea or suggestion I'm working with C #.

jasgo
  • 21
  • 2
  • 1
    A PDF is a very complicated document format/container. Both AFP and PDF are reasonably understandable standards, the devil will be in the details. You might be better off looking for a library you can leverage. –  Aug 08 '17 at 19:04
  • I've been looking for an library but I haven't got it. Could you recommend some library? – jasgo Aug 08 '17 at 19:16
  • Lib recommendation are generally not on topic for StackOverflow. But you can just do a simple web search, no? "AFP to PDF C# library" –  Aug 08 '17 at 19:17
  • Thanks, but there is not information or some library in web search. – jasgo Aug 08 '17 at 21:20
  • I'd try tweaking your search terms. I see many commercial APIs advertising this. Free libraries might be harder to come by, but you might be able to do this in multiple steps. –  Aug 08 '17 at 21:28
  • 1
    the easy way? install a virtual printer able to create pdf files and then use shell verb "PrintTo" with an associated viewer (btb, papyrus,...) – owairc Aug 29 '17 at 12:47

0 Answers0