Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary file name added in CSV -> PDF conversion #219

Closed
nirav-patel opened this issue Jul 16, 2020 · 8 comments
Closed

Temporary file name added in CSV -> PDF conversion #219

nirav-patel opened this issue Jul 16, 2020 · 8 comments
Assignees
Labels
waiting-for-feedback We need additional information before we can continue

Comments

@nirav-patel
Copy link

Hi @sbraconnier, I am facing issue while converting any CSV file to PDF using jodconverter.

Original CSV File:
image

After PDF conversion: (Check temporary source file name added tempfile_166). Also date conversion on 1st column is not proper.
image

Here, temporary file name got added on each PDF page as shown in above image.

Using following versions:

jodconverter-local: 4.3.0
LibreOffice: 6.4.4
spring-boot 2

Can you please take a look why such temporary file name added?

Thanks,
Nirav

@sbraconnier
Copy link
Member

Hi there,

Could you please first try to open the file WITHOUT jodconverter and try an "export as pdf" manually? Let me know if the result is the same or not. To resolve this, we need to know first if it is a jodconverter issue or a LibreOffice one. If it is an issue with LibreOffice, we need to know if LibreOffice support this, and which settings are required.

@nirav-patel
Copy link
Author

Hi @sbraconnier Thanks for the quick response.

I tried exporting original CSV file to PDF and it also displays file name on page header, so looks like LibreOffice issue.
Though I have noticed that dates exported to PDF properly as you can see in below screenshot. Using jod-converter, it displayed XXX for some reason as shown in previous comments.
image

Regarding filename as header, possibly some tweaks in LibreOffice settings may require.

@sbraconnier
Copy link
Member

Thanks!!! Could you please share your CSV so I could look into this using the same file as you (please remove all sensitive data first!)... Thanks!

@nirav-patel
Copy link
Author

nirav-patel commented Jul 20, 2020

I have attached sample CSV file with following zip.
sample_csv.zip

Thanks!

@sbraconnier
Copy link
Member

sbraconnier commented Jul 23, 2020

Strange, I didn't have the same problem as you, but the date column was different. Maybe you could take a look here and try to find the proper Filter Options for the CSV Filter that would work for you. The default one used by jodconverter is "44,34,0". The way I succeed to have a date column the same as you was by setting the column format to "TEXT", like this:

converter
        .convert(new File("C:\\temp\\sample_csv\\sample_csv.csv"))
        .as(DocumentFormat.builder()
                .from(DefaultDocumentFormatRegistry.CSV)
                .loadProperty("FilterOptions", "44,34,0,1,1/2")
                .build())
        .to(new File("C:\\temp\\sample_csv\\out.pdf"))
        .execute();

You may want to cache the created DocumentFormat instead of creating a new one for each conversion.

@jodconverter jodconverter deleted a comment from is-simon Jul 23, 2020
@sbraconnier sbraconnier self-assigned this Jul 23, 2020
@sbraconnier
Copy link
Member

Did you succeed ??

@sbraconnier sbraconnier added waiting-for-feedback We need additional information before we can continue and removed question labels Jan 13, 2021
@sbraconnier
Copy link
Member

Closing this one since I didn't received any feedback. Feel free to re-open if required.

@phoekoby
Copy link

I have same problem with convertation of csv file
Source:
example_quotes_escaped.csv
Result:
example_quotes_escaped.pdf

I tried to use your code:

converter
        .convert(new File("C:\\temp\\sample_csv\\sample_csv.csv"))
        .as(DocumentFormat.builder()
                .from(DefaultDocumentFormatRegistry.CSV)
                .loadProperty("FilterOptions", "44,34,0,1,1/2")
                .build())
        .to(new File("C:\\temp\\sample_csv\\out.pdf"))
        .execute();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-feedback We need additional information before we can continue
Projects
None yet
Development

No branches or pull requests

3 participants