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

PDF-XChange Editor SDK for Developers

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

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

Post by visual approvals »

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
Sasha - Tracker Dev Team
User
Posts: 5522
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 »

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:
https://sdkhelp.pdf-xchange.com/vie ... ocFromPath

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
visual approvals
User
Posts: 33
Joined: Wed Jul 10, 2013 6:29 pm

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

Post by visual approvals »

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
Sasha - Tracker Dev Team
User
Posts: 5522
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 »

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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
visual approvals
User
Posts: 33
Joined: Wed Jul 10, 2013 6:29 pm

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

Post by visual approvals »

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
Sasha - Tracker Dev Team
User
Posts: 5522
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 »

Hello Andre,

Additionally, you can use this method, to know what the error is exactly: https://sdkhelp.pdf-xchange.com/vie ... xtFromHRes

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
visual approvals
User
Posts: 33
Joined: Wed Jul 10, 2013 6:29 pm

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

Post by visual approvals »

Hi Alex
All good...got it sorted...thanks for your help :-)
Andre
Sasha - Tracker Dev Team
User
Posts: 5522
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 »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply