[MarkLogic Dev General] Error in saving a converted PDF file

Michael Blakeley michael.blakeley at marklogic.com
Thu May 3 08:05:20 PDT 2007


Vikas,

It sounds like you're trying to rebuild functionality that already 
exists in the Content Processing Framework (CPF). Why don't you simply 
set up CPF (per the docs), then call xdmp:document-load() with the path 
to your PDF?

If you set up CPF correctly, a set of triggers will do the PDF 
conversion for you.

-- Mike

PS - your problem is that cvt:save-converted-document takes a source 
URI, per 
http://developer.marklogic.com/pubs/3.1/apidocs/Convert.html#save-converted-documents 
- but you are giving it a filesystem path. Again, use CPF.

Vikas Jain wrote:
> Hi,
> 
>  
> 
> I am trying to build a small POC, where in I am trying to load a PDF
> document.
> 
>  
> 
> I tried using the xdmp:document-load to load the PDF document after
> converting the same using pdf-convert, but it will not work as
> xdmp:document-load expects a string but covert returns a series of
> nodes. 
> 
>  
> 
> Hence after digging s little, found another function that could be used
> to load the PDF document in Marklogic "cvt:save-converted-documents". 
> 
> Now before loading the document, I am trying to convert the same and
> then save it. The code below is what I am using
> 
>  
> 
> import module namespace pdf = "http://marklogic.com/cpf/pdf" 
> 
>                           at "/MarkLogic/conversion/pdf.xqy"
> 
>  
> 
> import module namespace cvt = "http://marklogic.com/cpf/convert" 
> 
>                           at "/MarkLogic/conversion/convert.xqy"
> 
>  
> 
>   let $results := xdmp:pdf-convert(
> xdmp:document-get("C:\Vikas\MarkLogic_3.1_pubs\MarkLogic_3.1_pubs\pubs\b
> ooks\admin.pdf"), "admin.pdf" )
> 
>   return 
> 
>  
> cvt:save-converted-documents("C:\Vikas\MarkLogic_3.1_pubs\MarkLogic_3.1_
> pubs\pubs\books\admin.pdf", "admin.pdf",
> 
>         $results[1], $results[2 to last()] );
> 
>  
> 
> Now on executing the command I am getting the following error:
> 
> 
> 500 Internal Server Error
> 
> 
> XDMP-DOCNOTFOUND: xdmp:document-add-properties("admin.pdf", /lnk:link)
> -- Document not found 
> 
> in /MarkLogic/cpf/links.xqy, on line 476,
> in lnk:insert-property(/lnk:link/@to, /lnk:link) 
> 
> $lnk:uri = xs:anyURI("admin.pdf")
> $lnk:link = /lnk:link
> $lnk:existing-link = ()
> $lnk:trace = () 
> 
> in /MarkLogic/cpf/links.xqy, on line 48,
> in lnk:insert(/lnk:link) 
> 
> $lnk:link = /lnk:link 
> 
> in /MarkLogic/cpf/links.xqy, on line 33,
> in lnk:create("admin_pdf_parts/", "admin.pdf", "source", "conversion",
> "strong") 
> 
> $lnk:from = "admin_pdf_parts/"
> $lnk:to = "admin.pdf"
> $lnk:role = "source"
> $lnk:rev-role = "conversion"
> $lnk:strength = "strong" 
> 
> in /MarkLogic/conversion/convert.xqy, on line 203,
> in cvt:save-converted-documents("admin.pdf", "admin.pdf", /parts,
> (doc(""), doc(""), doc(""), ...)) 
> 
> $source-uri = "admin.pdf"
> $destination-uri = "admin.pdf"
> $manifest = /parts
> $docs = (fn:doc(""), fn:doc(""), fn:doc(""), ...)
> $destination-uri = "admin.pdf"
> $subdirs = "admin_pdf_parts/"
> $has-main = fn:false()
> $insert-main = ()
> $dir = "admin_pdf_parts/" 
> 
> in /use-cases/load1.xqy, on line 10 
> 
> $results = (/parts, doc(""), doc(""), ...) 
> 
>  
> 
> Request you to please let me know where I am doing things wrong.
> 
>  
> 
> Thanks for help in advance.
> 
>  
> 
> Regards
> 
> Vikas Jain | GlobalLogic India
> Disclaimer: http://www.globallogic.com/email_disclaimer.txt
> <http://www.globallogic.com/email_disclaimer.txt> 
> 
>  
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4532 bytes
Desc: S/MIME Cryptographic Signature
Url : http://xqzone.marklogic.com/pipermail/general/attachments/20070503/d8da7c00/smime.bin


More information about the General mailing list