Print Page | Close Window

Generating images : Error Msg

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=536
Printed Date: 22 Nov 24 at 6:54PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Generating images : Error Msg
Posted By: beowax
Subject: Generating images : Error Msg
Date Posted: 17 Oct 06 at 10:19AM
Hi !

I'm still watching for generating images from pdf files...

Now, the code seems to be OK, but I have problems with few files... Here is the Error :
       iSED.QuickPDF erreur '8000ffff'
       Cannot create file "c:\windows\system32\inetsrv\0.jpg". Accès refusé
       /admin/cat-upload-pdf.asp, ligne 94

And my ASP Code :

     'On place le fichier dans le répertoire d'upload temporaire...
     Set Upload = Server.CreateObject("Persits.Upload.1")
     Upload.Save Server.Mappath("/upload/")
     IDCatalogue = Upload.Form.Item("id").Value
     
     'On sauvegarde le chemin du fichier PDF téléchargé     
     FichierCatalogue = Upload.Files("FichierPDF").Path
     
     'On crée l'objet QuickPDF
     Dim QP
     Set QP = Server.CreateObject("iSED.QuickPDF")
     Call QP.UnlockKey(PDFLicence)
     
     'On ouvre le fichier téléchargé
     QP.LoadFromFile(FichierCatalogue)
     
     'On tente de le decrypter...
     If QP.DecryptFile(FichierCatalogue,FichierCatalogue,false)=0 Then
          If QP.Unencrypt = 0 Then
               Response.Write(":(")
          Else
               Response.Write(":)")
          End If
     Else
          Response.Write(":)")
     End If
     
     'On crée les images à partir du fichier
     QP.SelectPage 1
          
     If (QP.RenderDocumentToFile(150, 1, QP.PageCount, 1, Server.MapPath(CheminCatalogue) & "/img/large/page-%p.jpg")=0) Then
          Response.Write("Erreur lors de la transformation du fichier !!!")
     Else
          Response.Write("OK !")
     End If

In bold, the line which causes the error...

What is this error about ?



Replies:
Posted By: beowax
Date Posted: 18 Oct 06 at 3:49AM
Does anybody had the same problem ???


Posted By: Ingo
Date Posted: 18 Oct 06 at 6:00AM
Hi!
You have enough rights to access system32?
Try with another directory... The same error?
Perhaps the 0.jpg already exists?
Best regards,
Ingo


Posted By: beowax
Date Posted: 18 Oct 06 at 8:24AM
Originally posted by Ingo Ingo wrote:

Hi!
You have enough rights to access system32?
Try with another directory... The same error?
Perhaps the 0.jpg already exists?
Best regards,
Ingo


Hi, actually, i'm not writing anything in this directory, i guess the method is doing it... I write on d:/... not on c:/...

And few files are passing trought the script succesfully !

:)


Posted By: Ingo
Date Posted: 18 Oct 06 at 10:22AM
Hi!

No... I think it's C   ;-)
Cannot create file "c:\windows\system32\inetsrv\0.jpg". Accès refusé

Best regards,
Ingo


Posted By: beowax
Date Posted: 19 Oct 06 at 3:04AM
Originally posted by Ingo Ingo wrote:

No... I think it's C   ;-)
Cannot create file "c:\windows\system32\inetsrv\0.jpg". Accès refusé


No, this message occurs only when the file is causing trouble, the files are wroten in D:/www/upload (path génerated with the Server.Mappath("/upload/") method !!!

I have never specified the c:/windows/system32 folder, i'm not that crazy ! :)

Don't you have an idea for resolving that ?

If you want to test :
File that is working : http://www.thinktwice.info/quickpdf/ok.pdf - http://www.thinktwice.info/quickpdf/ok.pdf
File that is not working : http://www.thinktwice.info/quickpdf/nok.pdf - http://www.thinktwice.info/quickpdf/nok.pdf

Regards,
Antoine


Posted By: Ingo
Date Posted: 19 Oct 06 at 3:40AM
Hi Antoine!

The ok.pdf includes imagesfiles but they are NOT inserted as "embedded imagefiles".
The nok.pdf includes two imagefiles inserted as "embedded imagefiles".
Perhaps there's the problem?

Again to the error-message... "Anybody" wants to write a jpg-file in c...system32... This is what the error-message is telling you. Who's doing this ;-)

Best regards,
Ingo


Posted By: beowax
Date Posted: 19 Oct 06 at 4:43AM
Originally posted by Ingo Ingo wrote:

Again to the error-message... "Anybody" wants to write a jpg-file in c...system32... This is what the error-message is telling you. Who's doing this ;-)


I Guess the function 'RenderDocumentToFile' is doing it, cause i'm not...

I'm webdevelopper since 2005, and i can bet 100 box with you my code is not writing on C:... My Web folder is on D:, and the successful files are really on D:

By the way, how do you get his 'embedded imagefiles' property ? I'm gonna check with few files that don't work...

By the way, I added few files :
- http://www.thinktwice.info/quickpdf/ok-2.pdf
- http://www.thinktwice.info/quickpdf/ok-3.pdf
- http://www.thinktwice.info/quickpdf/nok-2.pdf
- http://www.thinktwice.info/quickpdf/nok-3.pdf
- http://www.thinktwice.info/quickpdf/nok-4.pdf

Regards,
Antoine


Posted By: Ingo
Date Posted: 19 Oct 06 at 5:27AM
Originally posted by beowax beowax wrote:

By the way, how do you get his 'embedded imagefiles' property ?


Hi!

My PDF-Analyzer did this for me ;-)

Best regards,
Ingo


Posted By: Ingo
Date Posted: 19 Oct 06 at 6:54AM
Hi Antoine!

nok-4.pdf is a monster ... Needs a bit time to analyze ;-)
Sorry but embedded or not doesn't seem to be the problem. All files (ok and nok) have partly same properties...

We should look into the function-source: What happens if it returns an error?

Best regards,
Ingo


Posted By: ukobsa
Date Posted: 19 Oct 06 at 7:25AM
Antoine,

just an idea: can you check QuickPDFs temppath?

Use:

- GetTempPath gives you the current one
- SetTempPath(Path) can used to set it to a userdefined one
- TestTempPath checks the current temp path to have read/write access

maybe this explains the writing on 'c:\windows\system32\inetsrv';


HTH,
Uli


Posted By: beowax
Date Posted: 19 Oct 06 at 10:02AM
Originally posted by ukobsa ukobsa wrote:

- GetTempPath gives you the current one
- SetTempPath(Path) can used to set it to a userdefined one
- TestTempPath checks the current temp path to have read/write access


The TempPath is C:\WINDOWS\TEMP\, not c:\windows\system32\inserv, I have already changed that to another value, but the problem is the same... Actually, i don't think it's a permission problem becaus few files are passing trough the script successfully...

By the way the 0.jpg file can also be 1568.jpg or anything else...

Here is the full code of the page...

<!-- #include virtual="/includes/param.asp" -->
<%
     
     Server.ScriptTimeout = 180

     PDFLicence = "000000000000000000000000000000"
     
     'Putting file in /upload/
     Set Upload = Server.CreateObject("Persits.Upload.1")
     Upload.Save Server.Mappath("/upload/")
     IDCatalogue = Upload.Form.Item("id").Value


     'Grabbing path to write to
     Set RS = Server.CreateObject("Adodb.recordset")
     SQL = "SELECT CLIENT_Directory, CATALOGUE_Directory FROM TBL_CLIENT, TBL_CATALOGUE WHERE FK_CLIENT_Id = CLIENT_Id AND CATALOGUE_Id=" & IDCatalogue & " AND CLIENT_Id = " & Session("ADMIN_IdClient")
     RS.Open SQL, MyConn, 3, 3
     'Response.Write SQL
     CheminCatalogue = RS("CLIENT_Directory") & RS("CATALOGUE_Directory")
     
     'Saving the path to the file     
     FichierCatalogue = Upload.Files("FichierPDF").Path
     
     ' QuickPDF Stuff
     Dim QP
     Set QP = Server.CreateObject("iSED.QuickPDF")
     Call QP.UnlockKey(PDFLicence)
     
     'Opening the file...
     QP.LoadFromFile(FichierCatalogue)

     'Security Info
     'For i=0 To 10
          'Response.Write (i & ": " & QP.SecurityInfo(i) & "<br />")
     'Next
     
     'Decrypt...
     If QP.DecryptFile(FichierCatalogue,FichierCatalogue,Upload.Form.Item("pwd").Value)=0 Then
          If QP.Unencrypt = 0 Then
               Response.Write(":(")
          Else
               Response.Write("Unencrypt :)")
          End If
     Else
          Response.Write("DecryptFile :)")
     End If
     
     'Checking if path are already created...

     Set FSO = CreateObject("Scripting.FileSystemObject")
     
     If Not FSO.FolderExists(Server.Mappath(CheminCatalogue)) Then
          FSO.CreateFolder(Server.Mappath(CheminCatalogue))
     End If
     If Not FSO.FolderExists(Server.Mappath(CheminCatalogue) & "/img") Then
          FSO.CreateFolder(Server.Mappath(CheminCatalogue) & "/img")
     End If
     If Not FSO.FolderExists(Server.Mappath(CheminCatalogue) & "/img/large") Then
          FSO.CreateFolder(Server.Mappath(CheminCatalogue) & "/img/large")
     End If
     If Not FSO.FolderExists(Server.Mappath(CheminCatalogue) & "/img/medium") Then
          FSO.CreateFolder(Server.Mappath(CheminCatalogue) & "/img/medium")
     End If
     If Not FSO.FolderExists(Server.Mappath(CheminCatalogue) & "/img/small") Then
          FSO.CreateFolder(Server.Mappath(CheminCatalogue) & "/img/small")
     End If


     QP.SelectPage 1


     'On crée les images à partir du fichier
     If (QP.RenderDocumentToFile(72, 1, QP.PageCount, 1, Server.MapPath(CheminCatalogue) & "/img/large/page-%p.jpg")=0) Then
          Response.Write("Erreur lors de la transformation du fichier !!!")
     Else
          Response.Write("OK !")
     End If     

     'For DB insertion
     Set RS = Server.CreateObject("Adodb.recordset")
     SQL = "SELECT PAGE_Ordre FROM TBL_PAGE WHERE FK_CATALOGUE_Id=" & IDCatalogue & " ORDER BY PAGE_Ordre DESC"
     Response.Write SQL & "<br /><br />"
     RS.Open SQL, MyConn, 3, 3
     
     If (RS.EOF) Then
          MyOrdre = 0
     Else
          MyOrdre = RS("PAGE_Ordre") + 1
     End If
     
     'On insère les pages dans le catalogue
     For i=1 To QP.PageCount
          'On insère l'image dans la base de donnée
          SQL = "INSERT INTO TBL_PAGE (PAGE_FichierImage, PAGE_Libelle, PAGE_Ordre, FK_CATALOGUE_Id) VALUES ('page-" & i & ".jpg', 'Page " & (MyOrdre + 1) & "', " & MyOrdre & ", " & IDCatalogue & ")"
          MyConn.Execute SQL
          Response.Write SQL
          MyOrdre = MyOrdre + 1

          'On copie l'image vers les répertoires medium et small
          Set canvas = CreateObject("ImageGlue6.Canvas")
          theFile = Server.Mappath(CheminCatalogue) & "\img\large\page-" & i & ".jpg"
          canvas.DrawFile theFile, "height<=550"
          canvas.SaveAs Server.Mappath(CheminCatalogue) & "\img\medium\page-" & i & ".jpg", ""
          canvas.Clear
          
          Set canvas = CreateObject("ImageGlue6.Canvas")
          theFile = Server.Mappath(CheminCatalogue) & "\img\large\page-" & i & ".jpg"     
          canvas.DrawFile theFile, "width<=100"
          canvas.SaveAs Server.Mappath(CheminCatalogue) & "\img\small\page-" & i & ".jpg", ""
          canvas.Clear
          
          'Et on resize...
          
     Next     
     
     'Deleting the temp file...
     FSO.DeleteFile(Upload.Files("FichierPDF").Path)
     
     'On libère les variables
     Set FichierCatalogue = Nothing
     Set QP = Nothing
     Set Upload = Nothing
     Set FSO = Nothing
     Set canevas = Nothing
     
     'Redirecting...
     Response.Redirect("pages-manage.asp?id=" & IDCatalogue)
     Set IDCatalogue = Nothing     
%>


Posted By: beowax
Date Posted: 19 Oct 06 at 10:04AM
The error is on the line
           If (QP.RenderDocumentToFile(72, 1, QP.PageCount, 1, Server.MapPath(CheminCatalogue) & "/img/large/page-%p.jpg")=0) Then

Regards,
Antoine


Posted By: bogey
Date Posted: 19 Oct 06 at 10:12AM

Originally posted by beowax beowax wrote:

The error is on the line
           If (QP.RenderDocumentToFile(72, 1, QP.PageCount, 1, Server.MapPath(CheminCatalogue) & "/img/large/page-%p.jpg")=0) Then

Regards,
Antoine

Where does Server.MapPath(CheminCatalogue) resolve to?

Could the "%" in the filename be causing a problem?

 



Posted By: beowax
Date Posted: 20 Oct 06 at 3:11AM
Originally posted by bogey bogey wrote:

Where does Server.MapPath(CheminCatalogue) resolve to?



This path is pointing to dynamic folders in my D:/www/...

Originally posted by bogey bogey wrote:

Could the "%" in the filename be causing a problem?



I tried with and without the "%", but it is a parameter allowed by the function :

Originally posted by QuickPDF Doc QuickPDF Doc wrote:

The path and filename to use for the file. Each page will be stored in a separate file. If this
parameter contains "%p" this will be replaced by the page number, otherwise the page
number will be appended to the end of the filename before the extension. For example, if
FileName is "output.jpg" and page 10 is rendered the image will be stored in a file called
"output10.jpg". If FileName is "page%poutput.bmp" and page 5 is rendered the image will be
stored in a file called "page5output.bmp".



Posted By: beowax
Date Posted: 24 Oct 06 at 3:10AM
Originally posted by beowax beowax wrote:

Originally posted by bogey bogey wrote:

Where does Server.MapPath(CheminCatalogue) resolve to?



This path is pointing to dynamic folders in my D:/www/...

Originally posted by bogey bogey wrote:

Could the "%" in the filename be causing a problem?



I tried with and without the "%", but it is a parameter allowed by the function :

Originally posted by QuickPDF Doc QuickPDF Doc wrote:

The path and filename to use for the file. Each page will be stored in a separate file. If this
parameter contains "%p" this will be replaced by the page number, otherwise the page
number will be appended to the end of the filename before the extension. For example, if
FileName is "output.jpg" and page 10 is rendered the image will be stored in a file called
"output10.jpg". If FileName is "page%poutput.bmp" and page 5 is rendered the image will be
stored in a file called "page5output.bmp".



Still no idea ?


Posted By: ukobsa
Date Posted: 24 Oct 06 at 5:24AM
Have you tried to render to a fixed file to see if this works? (say render to "/img/large/testpage.jpg")

I have tried some of your PDFs from a delphi app and the render fine, so it seems to be a different issue.

HTH,
Uli


Posted By: beowax
Date Posted: 24 Oct 06 at 8:02AM
Originally posted by ukobsa ukobsa wrote:

Have you tried to render to a fixed file to see if this works? (say render to "/img/large/testpage.jpg")

I have tried some of your PDFs from a delphi app and the render fine, so it seems to be a different issue.

HTH,
Uli


Yes, same issue...

Originally posted by ISS ISS wrote:

Cannot create file "c:\windows\system32\inetsrv\0.jpg". Accès refusé


Posted By: bogey
Date Posted: 24 Oct 06 at 9:16AM

If you are getting "access refused" errors, then you have a file permissions problem.

Create a TEMP folder to store the PDFS and assign WRITE privledges to the INETUSR account.

 



Posted By: beowax
Date Posted: 25 Oct 06 at 3:13AM
Originally posted by bogey bogey wrote:

If you are getting "access refused" errors, then you have a file permissions problem.


Create a TEMP folder to store the PDFS and assign WRITE privledges to the INETUSR account.




As it works for few files, i don't think that it is a permission problem. What's more is that I can specify any folder, the error always occurs on c:/windows/...


Posted By: Pirmin
Date Posted: 25 Oct 06 at 5:32PM

Hi beowax

I have never used QuickPDF with ASP. But reading the iSEDQuickPDF Knowledge Base let me assume that you, or the ASP Programming Environment, has copied the ActiveX library (iSED.dll) to C:\WINDOWS\system32\inetsrv.
The QuickPDF commands you use with ASP are then executed by C:\WINDOWS\system32\inetsrv\iSED.dll.
If you are using a DLL with a version lower than 5.12, a kind of debugging code wants to generate JPG files in the same folder (see the last post at http://www.quickpdf.org/forum/forum_posts.asp?TID=297&PN=2 - www.quickpdf.org/forum/forum_posts.asp?TID=297&PN=2 ).
Upgrading to the newest DLL Version would fix this problem. If you already are using a version higher than 5.11 it must be something else.

Regards,
Pirmin



Posted By: marian_pascalau
Date Posted: 26 Oct 06 at 5:51AM

Hi there,

Pirmin is right. I can confirm that this was an isue with older QPDF versions. I don't know who solved that problem but it should never occur in the new version again.

Regards, Marian



Posted By: beowax
Date Posted: 27 Oct 06 at 11:31AM
OK, I'll check that as soon as I can, thank you.

I will inform you of the version number. ;)


Posted By: beowax
Date Posted: 30 Oct 06 at 3:03AM
My version is 5.11, but i can't find wexer versions on your website... Where can I find them ?

Regards,
Antoine


Posted By: beowax
Date Posted: 30 Oct 06 at 3:14AM
Originally posted by beowax beowax wrote:

My version is 5.11, but i can't find wexer versions on your website... Where can I find them ?

Regards,
Antoine


I saw the topic where the downloads are. ;)

I havn't got any .pas file. Is it possible me to send my key ?


Posted By: Ingo
Date Posted: 30 Oct 06 at 4:53AM
Hi!

If you have a source-license you can send the smallest source-file to Michel or to me and then we'll send you the new password for the source-section.

Best regards,
Ingo


Posted By: beowax
Date Posted: 31 Oct 06 at 8:27AM
Hi, The current version has solved the problem.

Thanks for your help,

Regards,
Antoine



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk