Save a pdf in a PDF/A format

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
mmasood
User
Posts: 99
Joined: Fri Sep 18, 2015 9:49 pm

Save a pdf in a PDF/A format

Post by mmasood » Thu Aug 18, 2016 5:30 pm

Hi,

I am using the latest version of PDF-XChange Core API 6.0.317. I want to open up a pdf file and save it as a PDF/A compliant file. I tried to look at the documentation and the forums but could not find anything. Is it possible to do it with the Core API? If yes, how?

Thanks,
M

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Fri Aug 19, 2016 6:26 am

Hello mmasood,

Currently that is only possible with the Editor SDK by using the PDFA plugin.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

mmasood
User
Posts: 99
Joined: Fri Sep 18, 2015 9:49 pm

Re: Save a pdf in a PDF/A format

Post by mmasood » Mon Aug 22, 2016 1:31 pm

Hi Alex,

Thanks for your reply. Do you have a sample that I can look into for this? Also is this a feature that will be available in the PRO SDK in the coming builds?

Regards,
M

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Mon Aug 22, 2016 2:05 pm

Hello mmasood,

I don't know about the PRO SDK so probably not.
Here's how you do it in the Editor SDK:
https://gist.github.com/Polaringu/3c87e ... 01f4cbcdb/
The plugin load part should look like this:

Code: Select all


// first you must get access to main object of SDK, BEFORE of instantiation of first PXV_Control object (i.e. before call of InitializeComponent())
PDFXEdit.PXV_Inst Inst = new PDFXEdit.PXV_Inst();
Inst.Init(null, licKey, prefsPathStr, histFileStr, histThumbsFileStr, (int)PDFXEdit.PXV_AppTypeFlags.PXV_AppType_SDK);
//Note that plugins must be loaded before the initialization of the control after you've initialized Instance
Inst.StartLoadingPlugins();
Inst.AddPluginFromFile("D:\\PDFAPlugin.pvp");
Inst.FinishLoadingPlugins();
//...
//Here's where the IPXV_Control is being created
InitializeComponent();
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

mmasood
User
Posts: 99
Joined: Fri Sep 18, 2015 9:49 pm

Re: Save a pdf in a PDF/A format

Post by mmasood » Tue Aug 23, 2016 6:27 pm

Hi Alex,

I created a sample WinForms application in C# and was able to convert a Pdf file into a PDF/A compliant file. However there are a couple of popups that come up and I have to dismiss them manually in order for the save operation to complete. The popups are:

1. The Conversion Report Dialog
2. The Save Dialog

Q1. Is there a way to do the save operation silently?
Q2. The code that you posted does not allow me to select the PDF/A conformance. How can I set that for a document?

On a separate note, I tried to create the "AxPDFXEdit.AxPXV_Control" programmatically but it is giving me an error. Following is the code:

Code: Select all

AxPDFXEdit.AxPXV_Control pdfControl = new AxPDFXEdit.AxPXV_Control();
pdfControl.CreateControl();

string lsName = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "Sample I - 1.pdf")).FullName;
pdfControl.OpenDocFromPath(lsName);
The last line gives me a Null Reference exception. The initialize code is in the Form's constructor before the call to InitializeComponent function. I am trying to do this so that I can move the code to a Class Library instead of a WinForms application.

Q3. Am I missing something here?

Regards,
M

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Wed Aug 24, 2016 5:07 am

Hello mmasood,

I wrote this code some time ago for someone here on forums - please check it out:
https://gist.github.com/Polaringu/3c87e ... f01f4cbcdb

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

mmasood
User
Posts: 99
Joined: Fri Sep 18, 2015 9:49 pm

Re: Save a pdf in a PDF/A format

Post by mmasood » Wed Aug 24, 2016 3:00 pm

Hi Alex,

This is the same code that you posted earlier. My questions from the post above are:

Q1. Is there a way to do the save operation silently?
Q2. The code that you posted does not allow me to select the PDF/A conformance. How can I set that for a document?
Q3. Why am I getting the Null reference exception when I run the code (mentioned above)?

Regards,
M

mmasood
User
Posts: 99
Joined: Fri Sep 18, 2015 9:49 pm

Re: Save a pdf in a PDF/A format

Post by mmasood » Thu Aug 25, 2016 2:15 pm

Hi,

I was verifying the code that you sent earlier and converted a file. Then i went to the following site:

http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx

and uploaded the file and the converted file is not compatible with any of the formats that are mentioned on the site. And there were no errors when Editor saved the file in the PDF/A compliant pdf. What is going on?

Regards,
M

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Thu Aug 25, 2016 2:22 pm

Hello mmasood,

As for the questions 1 and 2, please try using this code:

Code: Select all

PDFXEdit.IPXV_ExportConverter cnv = null;
for (uint i = 0; i < pdfCtl.Inst.ExportConvertersCount; i++)
{
	if (pdfCtl.Inst.ExportConverter[i].ID == "conv.exp.pdfa")
		cnv = pdfCtl.Inst.ExportConverter[i];
}
if ((cnv == null) || (pdfCtl.Doc == null))
	return;
PDFXEdit.ICab cab = pdfCtl.Inst.GetFormatConverterParams(false, "conv.exp.pdfa");
PDFXEdit.ICabNode convParamsRoot = cab.Root;
//<!-- 1 - PDF/A-1; 2 - PDF/A-2; 3 - PDF/A-3 -->
//<Item id="Part" type="Int" defVal="2" />
//<!-- 0 - -a; 1 - -b; 2 - -u; -->
//<Item id="Conformance" type="Int" defVal="1" />
//This will do PDF/A-2b
convParamsRoot.SetInt("Part", 2);
convParamsRoot.SetInt("Conformance", 1);
convParamsRoot.SetInt("ShowReport", 0);
convParamsRoot.SetString("ErrorMessage", "false");
PDFXEdit.IString name = pdfCtl.Inst.CreateString("D:\\TestFile_res.pdf");
pdfCtl.Doc.Save(name, 0, null, cnv, cab);
As for the third question - I will look into it and write back.

And as for your problem - just launched my code that converts PDF to PDFA 2b and the validator gave me this: File: TestFile_res.pdf (pdfa-2b)

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

mmasood
User
Posts: 99
Joined: Fri Sep 18, 2015 9:49 pm

Re: Save a pdf in a PDF/A format

Post by mmasood » Thu Aug 25, 2016 8:00 pm

Hi Alex,

Thanks for the update, the code is working and now I know how to set the conformance level :). But I am having the same kind of issue that I cannot verify the converted pdf file. I think you might have missed a step there. You have to click the execute button on Step 2 on the website to get the validation results.

Anyways I am attaching the before and after files that I am using for the test. It can be any other file and I get the same results. Following is the result that I get from the validation website for this pdf:
8_26_2016 12_46_12 AM.pdf does not conform to PDF/A.

Validating file "8_26_2016 12_46_12 AM.pdf" for conformance level pdfa-1b
The value of the key Type is OutputIntents but must be OutputIntent.
The key CapHeight is required but missing.
The key StemV is required but missing.
The key S has a value Transparency which is prohibited. (3)
The document does not conform to the requested standard.
The document doesn't conform to the PDF reference (missing required entries, wrong value types, etc.).
The document contains transparency.
Done.
I was trying to get it to work with PDF/A 1-b.

Regards,
M
Attachments
Sample.pdf
Original File
(16.24 KiB) Downloaded 97 times
8_26_2016 12_46_12 AM.pdf
Converted File
(1.8 MiB) Downloaded 86 times

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Fri Aug 26, 2016 7:55 am

Hello mmasood,

We managed to reproduce that problem, though Ad*be analyzer says that the PDF/A format is correct. We will try to look into this and hopefully solve this problem.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

mmasood
User
Posts: 99
Joined: Fri Sep 18, 2015 9:49 pm

Re: Save a pdf in a PDF/A format

Post by mmasood » Fri Aug 26, 2016 9:22 pm

Hi Alex,

It is good to have the issue identified. What actually is the issue? and how long do you think it will take for a fix/work around?

Regards,
M

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Sun Aug 28, 2016 3:17 pm

Hello mmasood,

We will discuss this issue on our next team meeting and I will inform you about the results.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

whoit
User
Posts: 271
Joined: Tue Jul 07, 2015 3:30 pm

Re: Save a pdf in a PDF/A format

Post by whoit » Mon Aug 29, 2016 2:14 pm

Hi Alex -

Can you tell me:

1) When your next meeting is
and
2) When we can expect a fix?

We have a release deadline that we are going to miss since this is not working.

Thanks,
Wayne

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Mon Aug 29, 2016 2:17 pm

Hello whoit,

The meeting will be held tomorrow. We will discuss whether this is a problem or not (as I previously said Acr*bat indicates that everything is OK).

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Wed Aug 31, 2016 7:25 am

Hello mmasood,

This issue was addressed to the developers who made it and hopefully it will be fixed in one of the nearest releases.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

DeKo
User
Posts: 52
Joined: Thu Sep 28, 2017 9:45 am

Re: Save a pdf in a PDF/A format

Post by DeKo » Thu Nov 02, 2017 11:19 am

Hello,

sorry to dig up such an old post. But it kinda fits well in here.

Where can i find the plugin to use? And my list of exportconverter's doesn't have conv.exp.pdfa in it. Am i missing something?

Thanks!

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Thu Nov 02, 2017 12:43 pm

Hello DeKo,

The plugins are Editor SDK only.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

DeKo
User
Posts: 52
Joined: Thu Sep 28, 2017 9:45 am

Re: Save a pdf in a PDF/A format

Post by DeKo » Thu Nov 02, 2017 1:15 pm

Hello Alex,

thanks. But that doesnt help me that much unfortunatly. As far as i know our company has the Editor SDK (is there a way to confirm that? im not sure if anyone here knows what license we got, except our boss, but he is pretty busy).

In the example u used Inst.AddPluginFromFile() method. So, assuming we have the Editor SDK, where can i find the plugin(s)? Or does it load every avaiable plugins automatically? Im afraid i couldn't find any informations about plugins in the net. If you have a documentation about that, i'll gladly research that myself.

Thanks in advance!

Greetings,
Dennis

User avatar
Sasha - Tracker Dev Team
User
Posts: 4526
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Save a pdf in a PDF/A format

Post by Sasha - Tracker Dev Team » Sat Nov 04, 2017 7:24 am

Hello Dennis,

Well then you should have asked that question in the Editor SDK thread.
Anyways, as for the AddPluginFromFile question - use forum search - plenty of topics there:
https://www.tracker-software.com/forum3 ... %5B0%5D=66

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply