How do you read pdf from Istream in V4?
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
-
- User
- Posts: 47
- Joined: Mon Aug 31, 2015 11:38 pm
How do you read pdf from Istream in V4?
I'm trying to find out how to read a pdf from an Istream, but the PDF-ToolsV4SDK documentation does not specify a function for this.
Any help on this would be appreciated.
Thanks in advance.
Any help on this would be appreciated.
Thanks in advance.
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
-
- User
- Posts: 47
- Joined: Mon Aug 31, 2015 11:38 pm
Re: How do you read pdf from Istream in V4?
Thanks for your response Tracker Supp-Stefan.
Any idea how I can read from the Istream object and put it in _PXCDocument object?
Any idea how I can read from the Istream object and put it in _PXCDocument object?
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: How do you read pdf from Istream in V4?
Hello ap_mi,
Did you take a look at the above page (the method name is a link)?
There you can see a code sample showing you how to use the stream and save it to file - then you can read the data from there.
Regards,
Stefan
Did you take a look at the above page (the method name is a link)?
There you can see a code sample showing you how to use the stream and save it to file - then you can read the data from there.
Regards,
Stefan
-
- User
- Posts: 47
- Joined: Mon Aug 31, 2015 11:38 pm
Re: How do you read pdf from Istream in V4?
hello,
Yeah I took a look, but I was wondering if this could be done without writing it to a file but just reading it from memory instead? I know that in a previous version of this library there existed a function called PXCV_ReadDocumentFromIStream that did this, but can't seem to find this functionality here.
Thanks again for your help.
Yeah I took a look, but I was wondering if this could be done without writing it to a file but just reading it from memory instead? I know that in a previous version of this library there existed a function called PXCV_ReadDocumentFromIStream that did this, but can't seem to find this functionality here.
Thanks again for your help.
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: How do you read pdf from Istream in V4?
Hello ap_mi,
PXCV_ReadDocumentFromIStream is part of the Viewer AX SDK, not the Tools SDK - so it's a different library and product all together.
Regards,
Stefan
PXCV_ReadDocumentFromIStream is part of the Viewer AX SDK, not the Tools SDK - so it's a different library and product all together.
Regards,
Stefan
-
- User
- Posts: 47
- Joined: Mon Aug 31, 2015 11:38 pm
Re: How do you read pdf from Istream in V4?
Well...that makes sense now.
My end goal is to be able to apply pdf security for a pdf in memory without writing to disk. Would you happen to know if this is possible?
Thanks again for your help.
My end goal is to be able to apply pdf security for a pdf in memory without writing to disk. Would you happen to know if this is possible?
Thanks again for your help.
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: How do you read pdf from Istream in V4?
Hello ap_mi,
I checked with a colleague, and he told me that this would be possible with the Core API - which is a new SDK which will be the successor of the current Tools SDK. We are planning the release to be later today so please do download it and give it a try once available.
Regards,
Stefan
I checked with a colleague, and he told me that this would be possible with the Core API - which is a new SDK which will be the successor of the current Tools SDK. We are planning the release to be later today so please do download it and give it a try once available.
Regards,
Stefan
-
- User
- Posts: 47
- Joined: Mon Aug 31, 2015 11:38 pm
Re: How do you read pdf from Istream in V4?
Thanks for the info.
I checked for it today here: https://www.pdf-xchange.com/product/downloads/sdk
It looks like it hasn't become available yet, so I'll keep checking for it.
Thanks again.
I checked for it today here: https://www.pdf-xchange.com/product/downloads/sdk
It looks like it hasn't become available yet, so I'll keep checking for it.
Thanks again.
-
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
Re: How do you read pdf from Istream in V4?
Hi ap_mi,
It should be released and available within the next few hours, but syncing the upload to our cloud can take quite a while. If you don't see it up in an hour or two, I'd check back tomorrow and it should be available (acts of god notwithstanding).
Cheers,
It should be released and available within the next few hours, but syncing the upload to our cloud can take quite a while. If you don't see it up in an hour or two, I'd check back tomorrow and it should be available (acts of god notwithstanding).
Cheers,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
-
- User
- Posts: 47
- Joined: Mon Aug 31, 2015 11:38 pm
Re: How do you read pdf from Istream in V4?
Hello,
How can I get an example on how to apply pdf security using the core sdk? It seems that the documentation is still incomplete.
I saw this function that might do the trick, but still unclear on how it works: https://sdkhelp.pdf-xchange.com/vie ... etSecurity.
Thanks.
How can I get an example on how to apply pdf security using the core sdk? It seems that the documentation is still incomplete.
I saw this function that might do the trick, but still unclear on how it works: https://sdkhelp.pdf-xchange.com/vie ... etSecurity.
Thanks.
-
- Site Admin
- Posts: 3554
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
Re: How do you read pdf from Istream in V4?
This operation is not intended to be used without UI or with custom data as its parameters structure depends of security handler used.
If you want to secure document using UI (like in the end user Editor), you need to:
1. create an operation;
2. call its ShowSetupUI
3. and if user press OK, launch the operation (call Do method)
Or you can use SetStdEncryption method of IPXC_Document.
Please note, new security settings will be used after document save.
Here is sample code (C++):
That protects document with specified passwords and disable editing of the document.
HTH
If you want to secure document using UI (like in the end user Editor), you need to:
1. create an operation;
2. call its ShowSetupUI
3. and if user press OK, launch the operation (call Do method)
Or you can use SetStdEncryption method of IPXC_Document.
Please note, new security settings will be used after document save.
Here is sample code (C++):
Code: Select all
pDoc->SetStdEncryption(SEM_AV10, VARIANT_TRUE, PermF_User - PermF_Edit - PrivPermF_DocAssembly, L"111", L"123");
HTH
Tracker Software (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 47
- Joined: Mon Aug 31, 2015 11:38 pm
Re: How do you read pdf from Istream in V4?
I'm trying to call IPXC_Document.LoadContent which requires two pointers to IPXS_PDFVariant. How do I instantiate/create a IPXS_PDFVariant interface?
Actually, would it be possible for you to give me a complete example on how one would load a pdf into IPXC_Document?
Thanks for your help.
Actually, would it be possible for you to give me a complete example on how one would load a pdf into IPXC_Document?
Thanks for your help.
-
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
Re: How do you read pdf from Istream in V4?
Hi ap_mi,
Please take a look at the online documentation, here:
https://sdkhelp.pdf-xchange.com/vie ... C_Document
HTH!
Please take a look at the online documentation, here:
https://sdkhelp.pdf-xchange.com/vie ... C_Document
HTH!
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
-
- User
- Posts: 47
- Joined: Mon Aug 31, 2015 11:38 pm
Re: How do you read pdf from Istream in V4?
Yes, I've seen the online documentation. The documentation does not seem very complete and is lacking examples at this point in time. The documentation essentially contains a list of functions for each object/interface with hardly any description on the parameters for the methods nor any examples on how to instantiate many of the interface types.
Would it be possible for anyone here to go a little beyond this documentation and provide me a full example of how one would load a pdf document into IPXC_Document? More specifically, an example that instantiates all the objects and calls all the methods needed in order to load a pdf into IPXC_Document (in C++ preferably).
I'm assuming one would just need to call IPXC_Document.LoadContent() function, but like I mentioned earlier, there's hardly any description for the parameters nor how to instantiate the objects needed to pass arguments to this function.
Thanks.
Would it be possible for anyone here to go a little beyond this documentation and provide me a full example of how one would load a pdf document into IPXC_Document? More specifically, an example that instantiates all the objects and calls all the methods needed in order to load a pdf into IPXC_Document (in C++ preferably).
I'm assuming one would just need to call IPXC_Document.LoadContent() function, but like I mentioned earlier, there's hardly any description for the parameters nor how to instantiate the objects needed to pass arguments to this function.
Thanks.
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: How do you read pdf from Istream in V4?
Hello ap_mi,
I've asked colleagues from the dev team to help us here with an example. As soon as we can - we will post it here.
Regards,
Stefan
I've asked colleagues from the dev team to help us here with an example. As soon as we can - we will post it here.
Regards,
Stefan
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: How do you read pdf from Istream in V4?
Hi, ap_mi.
How to load a pdf document into the IPXC_Document:
HTH
How to load a pdf document into the IPXC_Document:
Code: Select all
//Class of the callback for the document authorization (if you don't have any documents with passwords you don't need it)
class ATL_NO_VTABLE CDocAuthCallbackImpl : public CComObjectRootEx<CComSingleThreadModel>, public ATL::IDispatchImpl<IPXC_DocAuthCallback, &__uuidof(IPXC_DocAuthCallback)>
{
public:
CDocAuthCallbackImpl() {}
~CDocAuthCallbackImpl() {}
public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CDocAuthCallbackImpl)
COM_INTERFACE_ENTRY(IPXC_DocAuthCallback)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
public:
STDMETHODIMP AuthDoc(IPXC_Document* pDoc, ULONG_T nFlags) override
{
if (!pDoc || !m_pxsInst)
return E_INVALIDARG;
//Checking whether the document has any security
ULONG_T nNameAtom = 0;
pDoc->GetSecurityHandlerType(VARIANT_FALSE, &nNameAtom);
if (nNameAtom == 0)
{
//No security so successfully opened doc
//...
return S_OK;
}
//Else we must provide a password
ULONG_T nStandard = 0;
m_pxsInst->StrToAtom(L"Standard", &nStandard);
PXC_PermStatus status = Perm_ReqGranted;
//Comparing whether the security handler type is Standard
if (nStandard != nNameAtom)
{
//We do not support this one
return E_INVALIDARG;
}
pDoc->AuthorizeWithPassword(L"YourPasswordHere", &status);
if (status != Perm_ReqGranted)
{
//We don't have permission to open doc
return E_FAIL;
}
return S_OK;
}
public:
IPXS_Inst* m_pxsInst = nullptr;
};
HRESULT OpenDocumentFromFileSample(LPCWSTR sFilePath, IPXC_Inst* pInst)
{
if (pInst == nullptr)
return E_INVALIDARG;
//Getting IPXS_Inst if you don't have it
IPXS_Inst* pSInst = nullptr;
IUnknown* pUnk = nullptr;
pInst->GetExtension(L"PXS", &pUnk);
if (pUnk)
pUnk->QueryInterface(&pSInst);
if (pSInst == nullptr)
return E_FAIL;
HRESULT hr = S_OK;
IPXC_Document* pDoc = nullptr;
do
{
CComObject<CDocAuthCallbackImpl>* pCoObj;// Callback where the AuthDoc function should be implemented for authorization if some of your documents have password protection else - nullptr as default
hr = CComObject<CDocAuthCallbackImpl>::CreateInstance(&pCoObj);
if (hr != S_OK)
break;
pCoObj->AddRef();
pCoObj->m_pxsInst = pSInst;
//Opening document from file with given file name with default parameters
hr = pInst->OpenDocumentFromFile(sFilePath, pCoObj, nullptr, 0, 0, &pDoc);
pCoObj->Release();
if (hr != S_OK)
break;
//Successfully opened doc
//...
} while (false);
pSInst->Release();
if (pDoc)
pDoc->Release();
return hr;
}
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ