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

Fix PDF export #10361

Merged
merged 13 commits into from
Oct 3, 2023
Merged

Fix PDF export #10361

merged 13 commits into from
Oct 3, 2023

Conversation

Luggas4you
Copy link
Contributor

@Luggas4you Luggas4you commented Sep 10, 2023

Fixes #10102

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@Luggas4you
Copy link
Contributor Author

Throws Exception: Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate org.apache.pdfbox.cos.COSDictionary.toString()

import java.nio.file.Path;
import java.util.List;
import java.util.Objects;
import java.io.IOException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intendation off?

}
exporter.exportToFileByPath(databaseContext, filePreferences, originalFilePath, abbreviationRepository);

Files.copy(Paths.get(originalFilePath.toString()), Paths.get(exportedFilePath.toString()), StandardCopyOption.REPLACE_EXISTING);
Copy link
Member

@Siedlerchr Siedlerchr Sep 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already have two Path objects, so you don't need that wrapping here

Suggested change
Files.copy(Paths.get(originalFilePath.toString()), Paths.get(exportedFilePath.toString()), StandardCopyOption.REPLACE_EXISTING);
Files.copy(originalFilePath, exportedFilePath), StandardCopyOption.REPLACE_EXISTING);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Files.copy(Paths.get(originalFilePath.toString()), Paths.get(exportedFilePath.toString()), StandardCopyOption.REPLACE_EXISTING);

try (PDDocument importedDocument = Loader.loadPDF(new File(exportedFilePath.toString()))) {
assertNotNull(importedDocument, "The imported document should not be null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use JabRef's PDF Importer for this so you can compare the exported entries with the imported entries
PdfEmbeddedBibFileImporterTest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the importer and commit it

@Luggas4you
Copy link
Contributor Author

I am still working on the test, these are the current results if I run the test:

grafik

@Luggas4you
Copy link
Contributor Author

I am still working on the test, these are the current results if I run the test:

grafik

I don't know what the "JabRef15179252027836258260pdf" file is.

I need not to use the filePath, but I currently do not know how I can resolve it (I could use one entry but the database contain's multiple)

@koppor
Copy link
Member

koppor commented Sep 25, 2023

DevCall:

Current functionality: One can write for one PDF the XMP data (and an embedded .bib file) to the PDF:

image

Mass update is possible at

image


Currently, File -> Export also offers export to PDF (XMP or embedded .bib file). Which causes an error.

In this PR, a new PDF is created if the PDF is not found.

We looking forward to user feedback.

We should write:

  • nested .bib files
  • XMP data (maybe only generic - if more than one entry: "JabRef library")
  • All entries rendered using the current preview style

We could even embed the PDFs inside the PDFs.

Pro: It is super-easy now. No ZIP-file generation/export and later import.

@Siedlerchr Siedlerchr marked this pull request as ready for review October 2, 2023 14:06
* upstream/main: (94 commits)
  Bump org.openrewrite.rewrite from 6.3.11 to 6.3.16 (JabRef#10442)
  Update all of lucene
  Bump org.apache.lucene:lucene-core from 9.7.0 to 9.8.0
  Bump com.dlsc.gemsfx:gemsfx from 1.77.0 to 1.82.0
  Accept LaTeX errors in comment field (JabRef#10436)
  Fix NPEs in UrlCleanup (JabRef#10435)
  Fix triggering workflows (JabRef#10433)
  Show exception in cleanup error (JabRef#10430)
  Exclude check for ampersand (&) at verbatim fields (JabRef#10419)
  fix checkstyle
  fix escaping of slashes
  fix checkstyle  and l10n
  Add TeXShop (macOS only)
  Fix casing
  First set fetcherWorker properties, then start the worker
  improve variable names
  checkstyle
  Fix fetcher worker execution on background thread
  Update contributing.md
  jakarta
  ...
@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 3, 2023
@Siedlerchr Siedlerchr added this pull request to the merge queue Oct 3, 2023
Merged via the queue into JabRef:main with commit a73bb07 Oct 3, 2023
16 checks passed
Siedlerchr added a commit that referenced this pull request Oct 6, 2023
…tworkShare

* upstream/main:
  Infer DOI from ArXiv identifier (#10449)
  Add TexShop Icon (#10447)
  Fix PDF export (#10361)

# Conflicts:
#	CHANGELOG.md
Siedlerchr added a commit that referenced this pull request Oct 8, 2023
…in-protected-terms-files

* upstream/main:
  Update src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java
  Fix saving on network drive under macOS
  Infer DOI from ArXiv identifier (#10449)
  Add TexShop Icon (#10447)
  Fix PDF export (#10361)
  Fixed SpringerFetcherTest and ACMPortalFetcherTest (#10445)
  Bump org.openrewrite.rewrite from 6.3.11 to 6.3.16 (#10442)
  Update all of lucene
  Bump org.apache.lucene:lucene-core from 9.7.0 to 9.8.0
  Bump com.dlsc.gemsfx:gemsfx from 1.77.0 to 1.82.0
  Accept LaTeX errors in comment field (#10436)
  fix checkstyle
  fix escaping of slashes
  fix checkstyle  and l10n
  Add TeXShop (macOS only)
@koppor koppor mentioned this pull request Oct 12, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
export / save status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PDF export XMP annotated PDF gives error message
4 participants