Error when try to view image files (Tiff or BMP)  SOLVED

PDF-XChange Editor SDK for Developers

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

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
visual approvals
User
Posts: 25
Joined: Wed Jul 10, 2013 6:29 pm

Error when try to view image files (Tiff or BMP)

Post by visual approvals » Wed Mar 22, 2017 2:28 am

Hi Guys

windows 10 ,framework 4.6.1 , win 64 dll ver 6.0.319.0

Im using the following to view a Tiff or bmp file in the viewer but am getting errors

public void OpenPdfDoc(string pFileName, string Display = "All")
{
if (pFileName != "")
{
try
{

axPXV_Control1.Inst.Settings["Docs.AutoSyncDocPanesLayouts"].v = false;
axPXV_Control1.Inst.FireAppPrefsChanged(PDFXEdit.PXV_AppPrefsChanges.PXV_AppPrefsChange_Documents);

PDFXEdit.IPXV_MainFrame secondMainFrame = axPXV_Control1.Inst.MainFrm[SupportClass.FrameCount];
secondMainFrame.OpenDocFrom(pxcInst.OpenDocumentFromFile(@CurrentPdfFilePath.ToString(), null));

if (axPXV_Control1.Doc != null)
{ PageCount = axPXV_Control1.Doc.CoreDoc.Pages.Count;
axPXV_Control1.Doc.ActiveView.Panes.Show(axPXV_Control1.Doc.ActiveView.PageThumbsView);


PDFXEdit.IUIX_ScrollContainer scrollContainer = GetParentScrollContainer(axPXV_Control1.Doc.ActiveView.PageThumbsView.Obj);
PDFXEdit.IUIX_CmdLine line = scrollContainer.CmdPaneTop[0];
PDFXEdit.IUIX_CmdBar bar = line[0];
PDFXEdit.IUIX_CmdItem item = bar.FindFirstItemByCmdName("cmd.delete");
item.Delete();

axPXV_Control1.Doc.ActiveView.Panes.Hide(axPXV_Control1.Doc.ActiveView.PagesView);

}

// axPXV_Control1.Inst.ExecUICmd("cmd.zoom.level.fitPage");


}
catch (Exception ex)
{
ShowErrorMessage(System.Runtime.InteropServices.Marshal.GetHRForException(ex));
}
}
}

The error occurs at secondMainFrame.OpenDocFrom(pxcInst.OpenDocumentFromFile(@CurrentPdfFilePath.ToString(), null));
ex is Exception from HRESULT: 0x82140002



PDF files dont cause any issues

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

Re: Error when try to view image files (Tiff or BMP)

Post by Sasha - Tracker Dev Team » Wed Mar 22, 2017 7:29 am

Hello visual approvals,

The exception occurs, because you are trying to open the image file on the core level and then pass the IPXC_Document to the editor's level. Only the editor's level uses converters in the OpenDoc methods. In your case, try using this method:
http://sdkhelp.tracker-software.com/vie ... ocFromPath

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

visual approvals
User
Posts: 25
Joined: Wed Jul 10, 2013 6:29 pm

Re: Error when try to view image files (Tiff or BMP)

Post by visual approvals » Thu Mar 23, 2017 3:14 am

Thanks for the reply,
I did spend some time experimenting with the method you advise but could not come to grips with it in a C# context

Are you able to provide some sample code in C# i could work from :-)
Thanks

Andre

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

Re: Error when try to view image files (Tiff or BMP)

Post by Sasha - Tracker Dev Team » Thu Mar 23, 2017 7:10 am

Hello Andre,

You simply should change this:

Code: Select all

secondMainFrame.OpenDocFrom(pxcInst.OpenDocumentFromFile(@CurrentPdfFilePath.ToString(), null));
To this:

Code: Select all

secondMainFrame.OpenDocFromPath(@CurrentPdfFilePath.ToString(), null);
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

visual approvals
User
Posts: 25
Joined: Wed Jul 10, 2013 6:29 pm

Re: Error when try to view image files (Tiff or BMP)

Post by visual approvals » Thu Mar 23, 2017 7:40 pm

Hi Alex
Thanks for the quick reply.
I did try that but get an invalid parameter exception.
Let me review my code and Ill have another go
Andre

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

Re: Error when try to view image files (Tiff or BMP)  SOLVED

Post by Sasha - Tracker Dev Team » Thu Mar 23, 2017 7:58 pm

Hello Andre,

Additionally, you can use this method, to know what the error is exactly: http://sdkhelp.tracker-software.com/vie ... xtFromHRes

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

visual approvals
User
Posts: 25
Joined: Wed Jul 10, 2013 6:29 pm

Re: Error when try to view image files (Tiff or BMP)

Post by visual approvals » Thu Mar 23, 2017 10:12 pm

Hi Alex
All good...got it sorted...thanks for your help :-)
Andre

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

Re: Error when try to view image files (Tiff or BMP)

Post by Sasha - Tracker Dev Team » Fri Mar 24, 2017 6:31 am

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

Post Reply