Hi!
I created a cpp application that uses the PDF-XChange Core API SDK.
It just creates a new document, puts some lines in it and saves it.
I'm using IPXC_Inst::NewDocument to create the document.
I read that I could use IPXC_Inst::NewDocumentEx with an ICab* parameter to save this newly created document in pdfa.
Could you show me please how to set this ICab's pdfstandard property? I couldn't find anything about ICabs in the documentation.
Thanks,
Michael
NewDocumentEx - pdfa
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, 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.
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.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: NewDocumentEx - pdfa
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: NewDocumentEx - pdfa
Hello Alex!
Thanks for the fast answer. I checked the post but I still have some questions.
I'm going to use the Editor SDK and load the pdfa plugin.
Do I have to create a pdf file then convert it to pdfa, or can I simply just create a new file and save it with pdfa?
Thanks,
Michael
Thanks for the fast answer. I checked the post but I still have some questions.
I'm going to use the Editor SDK and load the pdfa plugin.
Do I have to create a pdf file then convert it to pdfa, or can I simply just create a new file and save it with pdfa?
Thanks,
Michael
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: NewDocumentEx - pdfa
Hello Michael,
Please use forum search first - many questions are already answered:
viewtopic.php?f=66&t=31385&p=127658&hilit=pdfa#p126915
Cheers,
Alex
Please use forum search first - many questions are already answered:
viewtopic.php?f=66&t=31385&p=127658&hilit=pdfa#p126915
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: NewDocumentEx - pdfa
Dear Alex!
I read these posts, searched the forum and tried everything I found but I couldn't generate a PDF/A-1a document.
Here's the code I have right now:
IPXV_Inst* ipxvInst;
//Initialized IPXV_Inst* and loaded pdfa plugin
//Added a page, and put some content in it with lineto/moveto through IPXC_ContentCreator
//Then when I want to save the file:
IUnknown* spUnk;
ipxvInst->GetExtension(L"AFS", &spUnk);
PXV::IAFS_Inst* fsInst = (PXV::IAFS_Inst*)spUnk;
PXV::IAFS_Name* destPath = nullptr;
PXV::IAFS_FileSys* filesys = nullptr;
fsInst->get_DefaultFileSys(&filesys);
filesys->StringToName(L"c:\\...\\pdfatest.pdf", 0, NULL, &destPath);
int openFileFlags = (int)(PXV::AFS_OpenFileFlags::AFS_OpenFile_CreateAlways | PXV::AFS_OpenFileFlags::AFS_OpenFile_Read | PXV::AFS_OpenFileFlags::AFS_OpenFile_Write | PXV::AFS_OpenFileFlags::AFS_OpenFile_FullCache);
PXV::IAFS_File* destFile = nullptr;
filesys->OpenFile(destPath, openFileFlags, nullptr, nullptr, &destFile);
PXV::IPXV_ExportConverter* cnv = nullptr;
PXV::ULONG_T max = 0;
ipxvInst->get_ExportConvertersCount(&max);
for (PXV::ULONG_T i = 0; i < max; i++)
{
PXV::IPXV_ExportConverter* tempcnv = nullptr;
ipxvInst->get_ExportConverter(i, &tempcnv);
BSTR getstr = L"";
BSTR pdfastr = L"conv.exp.pdfa";
tempcnv->get_ID(&getstr);
if (!wcscmp(getstr, pdfastr))
ipxvInst->get_ExportConverter(i, &cnv);
}
if (cnv != nullptr)
{
PXV::ICab* cab = nullptr;
PXV::ICabNode* cabnode = nullptr;
ipxvInst->GetFormatConverterParams(VARIANT_FALSE, L"conv.exp.pdfa", &cab);
cab->get_Root(&cabnode);
hr = cabnode->SetInt(L"Part", 2);
hr = cabnode->SetInt(L"Conformance", 1);
hr = cnv->Convert(ipxvInst, m_pDoc, destFile, 0, cab, NULL, 0, NULL, NULL);
}
m_pDoc->WriteTo(destFile, NULL, 0);
The file is created but it's version is still PDF 1.7
Can you help me out here please?
Thanks,
Michael
I read these posts, searched the forum and tried everything I found but I couldn't generate a PDF/A-1a document.
Here's the code I have right now:
IPXV_Inst* ipxvInst;
//Initialized IPXV_Inst* and loaded pdfa plugin
//Added a page, and put some content in it with lineto/moveto through IPXC_ContentCreator
//Then when I want to save the file:
IUnknown* spUnk;
ipxvInst->GetExtension(L"AFS", &spUnk);
PXV::IAFS_Inst* fsInst = (PXV::IAFS_Inst*)spUnk;
PXV::IAFS_Name* destPath = nullptr;
PXV::IAFS_FileSys* filesys = nullptr;
fsInst->get_DefaultFileSys(&filesys);
filesys->StringToName(L"c:\\...\\pdfatest.pdf", 0, NULL, &destPath);
int openFileFlags = (int)(PXV::AFS_OpenFileFlags::AFS_OpenFile_CreateAlways | PXV::AFS_OpenFileFlags::AFS_OpenFile_Read | PXV::AFS_OpenFileFlags::AFS_OpenFile_Write | PXV::AFS_OpenFileFlags::AFS_OpenFile_FullCache);
PXV::IAFS_File* destFile = nullptr;
filesys->OpenFile(destPath, openFileFlags, nullptr, nullptr, &destFile);
PXV::IPXV_ExportConverter* cnv = nullptr;
PXV::ULONG_T max = 0;
ipxvInst->get_ExportConvertersCount(&max);
for (PXV::ULONG_T i = 0; i < max; i++)
{
PXV::IPXV_ExportConverter* tempcnv = nullptr;
ipxvInst->get_ExportConverter(i, &tempcnv);
BSTR getstr = L"";
BSTR pdfastr = L"conv.exp.pdfa";
tempcnv->get_ID(&getstr);
if (!wcscmp(getstr, pdfastr))
ipxvInst->get_ExportConverter(i, &cnv);
}
if (cnv != nullptr)
{
PXV::ICab* cab = nullptr;
PXV::ICabNode* cabnode = nullptr;
ipxvInst->GetFormatConverterParams(VARIANT_FALSE, L"conv.exp.pdfa", &cab);
cab->get_Root(&cabnode);
hr = cabnode->SetInt(L"Part", 2);
hr = cabnode->SetInt(L"Conformance", 1);
hr = cnv->Convert(ipxvInst, m_pDoc, destFile, 0, cab, NULL, 0, NULL, NULL);
}
m_pDoc->WriteTo(destFile, NULL, 0);
The file is created but it's version is still PDF 1.7
Can you help me out here please?
Thanks,
Michael
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: NewDocumentEx - pdfa
Hello Michael,
This should already save to the needed file - no need to Write afterwards:
Cheers,
Alex
This should already save to the needed file - no need to Write afterwards:
Code: Select all
hr = cnv->Convert(ipxvInst, m_pDoc, destFile, 0, cab, NULL, 0, NULL, NULL);
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: NewDocumentEx - pdfa
Thanks Alex!
Works like a charm!
Thanks,
Michael
Works like a charm!
Thanks,
Michael
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: NewDocumentEx - pdfa
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ