Skip to content

Something bad happened inside TeX when including PDF image #58

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

Closed
emarsden opened this issue Jun 2, 2017 · 2 comments · Fixed by #133
Closed

Something bad happened inside TeX when including PDF image #58

emarsden opened this issue Jun 2, 2017 · 2 comments · Fixed by #133

Comments

@emarsden
Copy link

emarsden commented Jun 2, 2017

Problem with Tectonic 0.1.6-dev on Linux/AMD64.

Output from tectonic:

warning: could not calculate MD5 of file "bug.out": it does not exist
warning: Cannot parse cross-reference stream.
warning: Error while parsing PDF file.
error: something bad happened inside TeX; its output follows:

===============================================================================

===============================================================================

error: halted on potentially-recoverable error as specified

The input file (with file FonCSI.pdf in the current directory, downloadable from https://filebin.ca/3ObTUBGTUmmZ/FonCSI.pdf):

\documentclass{beamer}
\usepackage{tikz}
\setbeamertemplate{background canvas}{
  \begin{tikzpicture}[remember picture,overlay]
    \node[shift={(-0.8cm,0.6cm)}] at (current page.south east)
         {\href{https://risk-engineering.org/}{\includegraphics[width=1cm]{FonCSI}}};
  \end{tikzpicture}}

\begin{document}
\begin{frame}{Foo}
  Foo.
\end{frame}
\end{document}
@esmeetu
Copy link

esmeetu commented Jun 4, 2017

i have the same issue here, when insert '.pdf' ext picture file. But i got the right result file, where all pics(.pdf) embeded correctly. (Tectonic 0.1.5)

output:

note: this is a BETA release; report issues at https://github.com/tectonic-typesetting/tectonic/issues
Running TeX ...
warning: could not calculate MD5 of file "main.out": it does not exist
warning: pdf_open: Not a PDF 1.[1-5] file.
warning: pdf_open: Not a PDF 1.[1-5] file.
warning: Cannot parse cross-reference stream.
warning: Error while parsing PDF file.
error: something bad happened inside TeX; its output follows:

===============================================================================

===============================================================================

error: halted on potentially-recoverable error as specified

pkgw added a commit to pkgw/tectonic that referenced this issue Nov 16, 2017
This has been bugging me for a while. We'd just fail to parse certain included
PDF images that were just fine in other programs. As might have been guessed,
my new I/O layer was at fault. The way in which PDFs are read in involves
ungetc() commands followed by seeks followed by reads. I forgot to clear the
"ungetc" buffer when seeking, which meant that those reads erroneously pulled
out the most recent ungetc()ed character, which broke the PDF parsing.

Note that `seek(SEEK_CUR, 0)` must *not* clear the ungetc buffer in order for
the current PDF parsing code to work.

Fixes tectonic-typesetting#58.
@pkgw pkgw closed this as completed in #133 Nov 16, 2017
@pkgw
Copy link
Collaborator

pkgw commented Nov 16, 2017

This fix will be deployed in the imminent 0.1.7 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants