Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert SOLVED
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, 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: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hi Support,
Say I want to convert a Word DOC to PDF (IPXC_Document).
I can use op.openDoc IOperation with NativeOnly = false.
I can use IPXV_ImportConverter.Convert (after locating the correct converter).
Is IPXV_ImportConverter.Convert internally used by op.openDoc ?
If not, what's the (significant, only related to conversion) difference in using one approach vs another?
Also, please confirm that ICab pParams in Convert method *only* deals with options such as (for Word):
If so, how can I change, for example, "Convert with Markup" if using op.openDoc ?
Finally, what would be the IUnknown* pCtx in Convert method ?
-žarko
Say I want to convert a Word DOC to PDF (IPXC_Document).
I can use op.openDoc IOperation with NativeOnly = false.
I can use IPXV_ImportConverter.Convert (after locating the correct converter).
Is IPXV_ImportConverter.Convert internally used by op.openDoc ?
If not, what's the (significant, only related to conversion) difference in using one approach vs another?
Also, please confirm that ICab pParams in Convert method *only* deals with options such as (for Word):
If so, how can I change, for example, "Convert with Markup" if using op.openDoc ?
Finally, what would be the IUnknown* pCtx in Convert method ?
-žarko
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hello zarkogajic,
The op.openDoc operation tries all of the available registered converters (including the plugins) if the native converter returns that the opened file is not a PDF file. And yes, the IPXV_ImportConverter::Convert is used internally to do the conversion.
The difference in approaches, that some files can be theoretically opened by different converters - for example Text to PDF can process the CSV file that is normally being handled by the CSVToPDF converter. Meaning that if you want some specific converter to do the processing of the given file - then the IPXV_ImportConverter should be used directly. If you want us to find out which converter should be used for the given file automatically - then use the op.openDoc operation.
The ICab* pParams holds only the "Options" node (no Input or Output whatsoever), meaning that you can access to the needed setting from it directly.
The context interface can hold some additional data for the converter to work. It's being returned by the CheckFormat2 method in the IUnknown** pCheckRes parameter.
Cheers,
Alex
The op.openDoc operation tries all of the available registered converters (including the plugins) if the native converter returns that the opened file is not a PDF file. And yes, the IPXV_ImportConverter::Convert is used internally to do the conversion.
The difference in approaches, that some files can be theoretically opened by different converters - for example Text to PDF can process the CSV file that is normally being handled by the CSVToPDF converter. Meaning that if you want some specific converter to do the processing of the given file - then the IPXV_ImportConverter should be used directly. If you want us to find out which converter should be used for the given file automatically - then use the op.openDoc operation.
The ICab* pParams holds only the "Options" node (no Input or Output whatsoever), meaning that you can access to the needed setting from it directly.
The context interface can hold some additional data for the converter to work. It's being returned by the CheckFormat2 method in the IUnknown** pCheckRes parameter.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hi Alex,
Thanks, all clear on what happens behind the scenes.
-žarko
Thanks, all clear on what happens behind the scenes.
Can you give an example? Am not sure how to use this.The ICab* pParams holds only the "Options" node (no Input or Output whatsoever), meaning that you can access to the needed setting from it directly.
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hello zarkogajic,
For example we have this code for some operation:
In your case, the ICab pParams holds the Options dictionary:
Cheers,
Alex
For example we have this code for some operation:
Code: Select all
//C#
private void SetAnnotationData(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst, PDFXEdit.IPXC_Annotation Annotation)
{
//In this sample the Free Text Annotation is used
PDFXEdit.IPXC_AnnotData_FreeText FTData = (PDFXEdit.IPXC_AnnotData_FreeText)Annotation.Data;
FTData.Contents = "Test String";
int nID = Inst.Str2ID("op.annot.setData", false);
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
input.Add().v = Annotation;
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
options["NewData"].v = FTData;
Op.Do();
}
Code: Select all
pParams.Root["NeededValue"].v = "Some Data";
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hi Alex,
Yes, that part is clear.
But the "NeededValue" is what I do not know, for the set of options in the Options dialog in my initial post.
-žarko
Yes, that part is clear.
But the "NeededValue" is what I do not know, for the set of options in the Options dialog in my initial post.
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hello zarkogajic,
The possible values are:
Enum values:
Cheers,
Alex
The possible values are:
Code: Select all
{ L"MacroSecurity", dt_Int, 0, OfficeMacroSec_ForceDisable},
{ L"AllowConvFromRTF", dt_Bool, 0, _N(true), &g_NamedBool },
{ L"ConvertWithMarkup", dt_Bool, 0, _N(false), &g_NamedBool },
//Options from MS Word
{ L"UpdateFields", dt_Int, 0, Off2PdfWordOptVal_Default, },
Code: Select all
enum OfficeMacroSecurity
{
OfficeMacroSec_Undefined = 0,
OfficeMacroSec_Low = 1, //enable all macros
OfficeMacroSec_ByUI = 2, //normally not used (not reasonable, because user can't press office macro-security UI button when opening office doc with Editor)
OfficeMacroSec_ForceDisable = 3 //disable all macros
};
enum Office2PDFWordOptValue
{
Off2PdfWordOptVal_Default = 0, //use MS Word's current value
Off2PdfWordOptVal_Yes = 1,
Off2PdfWordOptVal_No = 2,
};
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
HI Alex,
Yes, that's it, thanks!
-žarko
Yes, that's it, thanks!
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Alex,
When using op.openDoc to do conversion - I cannot set those, correct?
Can those be set via something like Inst.Settings[] ?
-žarko
When using op.openDoc to do conversion - I cannot set those, correct?
Can those be set via something like Inst.Settings[] ?
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hello zarkogajic,
Try changing those and see where are they being written in the registry. If they are - then you can tweak them.
Cheers,
Alex
Try changing those and see where are they being written in the registry. If they are - then you can tweak them.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Alex,
But what values to use in Inst.Settings[???] ?
-žarko
But what values to use in Inst.Settings[???] ?
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hello zarkogajic,
The settings path would be "Converters.Import.<Converter ID with . replaced as _>".
For example
Cheers,
Alex
The settings path would be "Converters.Import.<Converter ID with . replaced as _>".
For example
Code: Select all
Inst.Settings["Converters.Import.conv_imp_office_doc.AllowConvFromRTF"] = true;
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
HI Alex,
Fantastic!
And the "corresponding" PXV_AppPrefsChanges for Inst.FireAppPrefsChanged ?
-žarko
Fantastic!
And the "corresponding" PXV_AppPrefsChanges for Inst.FireAppPrefsChanged ?
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hello zarkogajic,
I don't see any particular event. Probably it's not needed in this case.
Cheers,
Alex
I don't see any particular event. Probably it's not needed in this case.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert SOLVED
Alex,
Ok. Thanks!
p.s.
And all the best in, hopefully better, 2021!
-ž
Ok. Thanks!
p.s.
And all the best in, hopefully better, 2021!
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert to PDF: op.openDoc (NativeOnly == false) vs IPXV_ImportConverter.Convert
Hello zarkogajic,
And best wishes for you too
Cheers,
Alex
And best wishes for you too
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ