-1

I am trying to set pdf/A-3B using PdfAWriter in c#. But it showing error. Can Any one help me?

I am getting error during declaration of PdfAWriter. PdfAWriter writer = PdfAWriter.GetInstance(document, ms, PdfAConformanceLevel.PDF_A_1A);enter image description here

I attached the screen short of the error.

  • 1
    The error explains what you are doing wrong. For instance: you can't create a valid PDF/A file without embedding all the fonts, or without adding a color profile, etc. I am down-voting your question because (1.) you don't tell us which error you get, and (2.) `PdfAWriter` is supposed to throw errors if you don't obey the rules of PDF/A (otherwise you'd be creating a PDF file that isn't compliant with the PDF/A standard). – Bruno Lowagie Jul 06 '17 at 19:11
  • 1
    Are we supposed to guess what the error message says? I don't like that game. –  Jul 06 '17 at 19:15
  • I edited my Question. Please answer now.Please.... – selva kumar Jul 06 '17 at 19:17
  • Possible duplicate of https://stackoverflow.com/questions/15118163/itextpdf-library-cant-find-the-class-com-itextpdf-text-pdf-pdfawriter –  Jul 06 '17 at 19:19
  • You aren't referencing the assembly that contains PdfAWriter (or you are missing using directive related to the namespace that contains that type). The error literally says so. Alternatively, in your copy of the third party library you are using, PdfAWriter does not actually exist as a type. – Trioj Jul 06 '17 at 19:20
  • @Trioj could you please specify which namespace or assembly i have to add? – selva kumar Jul 06 '17 at 19:25
  • I don't have access to the library that you are using, nor do I intend to google that for you. Why don't you check the documentation or code that you have for the third party library? Alternatively, hit Ctrl and then the period key while the cursor is on PdfAWriter and VS may offer you suggestions to resolve. – Trioj Jul 06 '17 at 19:26
  • For what it is worth, it is my suspicion that the PdfAWriter class does not exist at all in your third party library. If the code is open source, you should check their repo, or reflect their code if it can be reflected. If you cannot find the PdfAWriter anywhere in their code, then therein lies the problem. – Trioj Jul 06 '17 at 19:42
  • 1
    [Why is “Can someone help me?” not an actual question?](http://meta.stackoverflow.com/q/284236) – EJoshuaS - Stand with Ukraine Jul 06 '17 at 19:48
  • OK, thanks for editing the question. I removed my downvote. As for your problem, it is very simple. Someone already gave the correct answer in the comments: You need this class: https://github.com/itext/itextsharp/blob/develop/src/extras/itextsharp.pdfa/iTextSharp/text/pdf/PdfAWriter.cs The DLL that contains this class is in the release when you download [itextsharp-all-5.5.11.zip](https://github.com/itext/itextsharp/releases). It's the itextsharp.pdfa.dll in itextsharp-dll-pdfa.zip. – Bruno Lowagie Jul 06 '17 at 21:17

1 Answers1

1

You need the following DLL: itextsharp.pdfa.dll.

That DLL can be found in the following ZIP file: itextsharp-dll-pdfa.zip

This ZIP file can be downloaded here: itextsharp-all-5.5.11.zip

Make sure that all the DLLs you are using are of the same version. Don't use the 5.5.11 version of the PDF/A DLL with an older version of iText core.

Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165
  • 3
    Or simply use NuGet to avoid dll hell. – Amedee Van Gasse Jul 06 '17 at 21:37
  • @AmedeeVanGasse please tell me how to use NuGet in Visual studio. I already installed it for vs2013. – selva kumar Jul 07 '17 at 07:46
  • @Bruno Lowagie, Thanks a lot for your answer. I downloaded the the zip file but no dll is available in this zip file only c# codes are available. – selva kumar Jul 07 '17 at 07:48
  • @Bruno Lowagie I got the dll. Thanks a lot for your answer. – selva kumar Jul 07 '17 at 07:50
  • Use Visual Studio 2017, NuGet is built in. – Amedee Van Gasse Jul 07 '17 at 08:17
  • @selvakumar (1.) if the DLL wasn't in the ZIP file I mentioned, my answer was wrong. Please tell me what's wrong about it and explain how I can correct it (however, note the I *did* check the ZIP file and the DLL was there when I checked). (2.) If my answer helped you, please accept the answer (check mark next to the score) so that other people can see that the question was adequately solved. – Bruno Lowagie Jul 07 '17 at 14:31