You are viewing limited content. For full access, please sign in.

Question

Question

Importing PDFs Using ImportEdoc

asked on May 26, 2016 Show version history

I'm getting inconsistent results when I import PDFs into Laserfiche using ImportEdoc in the SDK. Some PDFs show up with PDF icon and open in the Laserfiche viewer. Others do not get the PDF icon, and open in Adobe. However, both show that they have the PDF extension and the application/PDF mime type when looking at their properties. Here are screen shots for comparison.

The PDFs that show up properly are being exported from a BLOB, and then imported from the file system. The PDFs that don't show up properly are not from the same source, but are also imported from the file system. I don't see why that would make a difference, but it seemed worth mentioning. They all open fine in Adobe. Anyone have any ideas?

 

0 0

Replies

replied on June 3, 2016

The icon in the client is based on the extension only, it does not factor in the mime type (but the mime type should not have spaces). I suspect the extension is being saved as "pdf " with a trailing space.

Try setting the extension on the DocumentInfo after calling ImportEdoc:

DocImp.ImportEdoc("application/pdf", @"C:\Temp\convert.pdf");
doc.Extension = "pdf";
doc.Save();

 

1 0
replied on May 26, 2016

Throwing stuff at the wall, have you tried adding the spaaces around the type value like the working ones have? 

0 0
replied on May 27, 2016

you can see why laserfiche is not showing pdf icon. ones that are show perfectly have type "application / pdf" whereas those that are not shown perfectly have type "application/pdf". 

it seems like there has to be a space between "application" "/" and "pdf".

where is this in consistency coming from. you mentioned 2 sources. are both of those sources use same function to be imported into laserfiche. 

please give us more info.

thanks

0 0
replied on June 2, 2016 Show version history

I tried adding the space, and that didn't make any difference. The PDFs that work are stored as blobs that I'm writing to disk and then importing. The PDFs that don't are already on the file system.

Line used for exported BLOBS: DocImp.ImportEdoc("application / pdf", @"C:\Temp\convert.pdf");

Line used for files already on disk: DocImp.ImportEdoc("application / pdf", (string)DR[1]); where DR[1] is the complete file path to the file, and includes the extension.

The problem PDFs now have the "application / pdf", but the behavior doesn't change.

When I drag and drop one of these problem documents directly into Laserfiche, it does work properly and also has "application / pdf" as the Type.

0 0
replied on June 2, 2016

there is definitely something wrong with (string)DR[1]. i know it includes the extension but try adding this +".pdf" at the end of it. 

I am sure there has to be a reason for it to behave like that. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.