Can't open PDF file

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

HoldThem
Posts: 6
Joined: Thu Jan 15, 2009 12:24 pm

Can't open PDF file

Post by HoldThem »

Hello there,

I have installed the latest version of Ghostscript, and the latest version of Gflax.

My ASP.net code is as follows:

Code: Select all

    'Initialise
    Dim graphicsCom As Object

    'Create the graphics object
    graphicsCom = Server.CreateObject("GflAx.GflAx")
    
    with graphicsCom
        .EpsDpi = 72 
        .page = 1
        .LoadBitmap(server.MapPath("test.pdf"))
	.Saveformat = 3
	.saveBitmap(server.MapPath("newPDF"))
    end with

    'Clean up
    graphicsCom = Nothing
I keep getting the error:

Code: Select all

Server Error in '/' Application.
Unknown format
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Unknown format

Source Error:

Line 10:         .EpsDpi = 72 
Line 11:         .page = 1
Line 12:         .LoadBitmap(server.MapPath("test.pdf"))
Line 13: 	.Saveformat = 3
Line 14: 	.saveBitmap(server.MapPath("newPDF"))


Source File: c:\inetpub\wwwroot\pdfToSWF\default.aspx    Line: 12

Stack Trace: [COMException (0x80004005): Unknown format]
   Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn) +791
   Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) +23
   ASP.default_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in c:\inetpub\wwwroot\pdfToSWF\default.aspx:12
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
   System.Web.UI.Control.Render(HtmlTextWriter writer) +7
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   System.Web.UI.Page.ProcessRequestMain() +1926
I have tried lots of things and can't seem to get it to work! It would be great to save the PDF pages as a JPG/PNG file.

Thanks for any help.

Tom[/quote]
chrisyung
Posts: 5
Joined: Fri Mar 26, 2010 7:38 am

Re: Can't open PDF file

Post by chrisyung »

Hi~
I have the same COMException (0x80004005) when I use GFLAx with C#
I found that if I do not load the pdf file, it is fine.
But when I load a pdf file it will show

[COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.]
GflAx.GflAxClass.LoadBitmap(String filename) +0
TutorialMapServer._Default.Page_Load(Object sender, EventArgs e) in C:\TimL\Visual Studio 2008\Projects\TutorialMapServer\TutorialMapServer\Default.aspx.cs:59
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Is it the problem with ghostscript, so that it can not open pdf?
I just install the ghostscript and copy the dll to system32 and also my bin folder, do I need to do any thing else?
like add reference to it?

Please help......please... :(
User avatar
xnview
Author of XnView
Posts: 44936
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Can't open PDF file

Post by xnview »

The PDF file can be loaded in XnView?
Pierre.
chrisyung
Posts: 5
Joined: Fri Mar 26, 2010 7:38 am

Re: Can't open PDF file

Post by chrisyung »

oh...that can't open...
um...do you know what kind of pdf can not open?
because I am using the mapserver and I need to show some construction plan in a layer
but seem the mapserver can not show pdf directly in their layer...
so what I would like to do is to convert the pdf to a image then show it in the layer.

so I would like to know what kind of pdf could be convert by GFLAX,
and what can not.
I have try PDFRasterizer.Net 3.0, that seem can convert all my pdf file to tiff but that cost too much
so I prefer to use GFLAX + ghostscript to convert most of the pdf (if over 75% of our pdf could be convert it will be fine)
all other pdf that can not convert I may ask someone to convert it manually.

I have just try to open another pdf, which can be open by xnview
the page just keep loading without any display...
chrisyung
Posts: 5
Joined: Fri Mar 26, 2010 7:38 am

Re: Can't open PDF file

Post by chrisyung »

I change to a pdf file that xnview could open it...
and when I run it in the IIS server, it will just keep loading
but when I run it under the visual studio development server then it work fine
don't know why...it is something about the setting about the IIS server?
User avatar
xnview
Author of XnView
Posts: 44936
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Can't open PDF file

Post by xnview »

chrisyung wrote:I change to a pdf file that xnview could open it...
and when I run it in the IIS server, it will just keep loading
but when I run it under the visual studio development server then it work fine
don't know why...it is something about the setting about the IIS server?
Sorry i don't know, my knowledge of IIS is very limited.
Pierre.
chrisyung
Posts: 5
Joined: Fri Mar 26, 2010 7:38 am

Re: Can't open PDF file

Post by chrisyung »

Thanks anyway~
seems now it is one step closer to the goal...
chrisyung
Posts: 5
Joined: Fri Mar 26, 2010 7:38 am

Re: Can't open PDF file

Post by chrisyung »

Anyone using IIS server and know what the problem is?
It work in visual studio development server but just keep loading when run in IIS...