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.
i'm trying to convert files to .pdf. My current approach is to open them with the PDF XChange Editor and then save them at the same location. So far so good. But when i try to do this in a thread or a task, i get a System.Runtime.InteropServices.COMException.
string[] files = Directory.GetFiles(, "C:\\Folder", SearchOption.AllDirectories);
IPXV_Inst ipxv = pdfCtl.Inst;
IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)pdfCtl.Inst.GetExtension("AFS"); //Getting IAFS_Inst from IPXV_Inst
//PDFXEdit.IAFS_Name dest;
int l = files.Length;
IPXV_Document[] docs = new IPXV_Document[l];
Thread task = new Thread(() => {
pdfCtl.OpenDocFromPath(files[0]);
IPXV_Document doc = pdfCtl.Doc;
doc.Save(fsInst.DefaultFileSys.StringToName(GivePDFName(files[0])), (int)PXV_DocSaveFlags.PXV_DocSave_AllowUI);
});
The GivePDFName-method returns the given path with .pdf. The pdfCtl is my AxPXV_Control.
Am i doing something wrong? Is my approach the wrong one? And also, it seems that i cant open all file-types in the pdf-xchange editor (xlsx, msg, eml aren't working)
thank you for replying so quick. Yes i checked the FullDemo and i've found something that can help me. So, the problem changed a bit: I still can't save in a Thread or a Task, seems like its impossible for PDFXEdit to Save 2 different files simultaneously. Correct me if i'm wrong.
You can't use the Control like that - one thread only.
You can use the IPXV_ImportConverter to convert from the different formats to the pdf (IPXC_Document). This can be done from multiple threads as this does not update the Control itself - only needs IPXV_Inst by the way. Here's the useful topic: https://www.pdf-xchange.com/forum3 ... 66&t=26367
Also, check out this wiki page: https://sdkhelp.pdf-xchange.com/view/PXV:CoClasses
thank you for the links. I didn't knew that there was a converter like this. I've checked the links and tried some things, but i dont quiet understand how exactly i can convert a given file. I've searched for an example, but with no success. I didnt see anything in the Full Demo either.
thank you for the example! It really helped me a lot. I've worked out an solution for my problem today thanks to your example. I even got it working without a control element (as i dont really need it) and in Tasks.
If anyone is interested or you, Alex, want me to show my example, i gladly share it.
PS: Sorry for not answering earlier, but i dont work on weekends
its me again. I didn't want to create a new topic, so i just ask here. Ofc anyone is free to anwser, not only sasha
I wanted to know if you can convert .eml and .msg to .pdf using the Editor SDK. I've searched the forums for a while and i didnt find a way (programatically, that is).
As far as I know, the End-User Editor does not support those types which basically means that the SDK won't support them too. You can write your own converter though - not necessarily to PDF but to the format that we can convert from.
Sorry to jump on the back of someone else's post, however I am wanting to convert files to PDF as well. Your code was a great start however I noticed on this line of code you are checking to see if the file is a tiff file and using the conv.imp.image.tiff converter.
Dim iConv As PDFXEdit.IPXV_ImportConverter = Inst.ImportConverter(i)
If iConv.ID.Equals("conv.imp.image.tiff") Then
.....
What I wanted to do is write a common conversion class that will convert any of your approved file types to PDF without having to rely on the control to convert them when loaded. Therefore how would I modify your above code to find the correct conversion type to use?
Loop through all of the available converters and make a list of them. Then make a converter-extension references - then you will have a table that would tell which converter is needed for each extension.
i'm back to the party! Jokes aside: I also needed a list of all avaiable converters. I looped through each converter, but then i hardcoded the indecies of the converters as an enum. When i saw your response, Alex, i kinda get the feeling that the avaible converters depend on something?
Could you clarify if it depends on something and if yes, depends on what?