pdf-rs / pdf_render Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
When I am doing "cargo run" in the examples/pdf2image directory, I get:
error[E0277]: the trait bound `pdf::file::File<Vec<u8>, NoCache, NoCache, NoLog>: Resolve` is not satisfied
--> examples/pdf2image/src/main.rs:40:31
|
40 | render_page(&mut backend, &file, &page, Transform2F::from_scale(opt.dpi / 25.4))?;
| ----------- ^^^^^ the trait `Resolve` is not implemented for `pdf::file::File<Vec<u8>, NoCache, NoCache, NoLog>`
| |
| required by a bound introduced by this call
|
= help: the trait `Resolve` is implemented for `NoResolve`
note: required by a bound in `render_page`
--> /home/nathan/projects/external/pdf-rs/pdf_render/render/src/lib.rs:81:63
|
81 | pub fn render_page(backend: &mut impl Backend, resolve: &impl Resolve, page: &Page, transform: Transform2F) -> Result<Transform2F, PdfError> {
| ^^^^^^^ required by this bound in `render_page`
For more information about this error, try `rustc --explain E0277`.
warning: `pdf2image` (bin "pdf2image") generated 1 warning
error: could not compile `pdf2image` (bin "pdf2image") due to previous error; 1 warning emitted
am I compiling it wrong? But this error should be independent of that ...
What is the structure of fonts.json ? Could you please post a sample fonts.json somewhere ?
I am getting the following error.
PDF: STANDARD_FONTS not set. using fonts/ instead.
thread 'main' panicked at 'can't read fonts.json: Os { code: 2, kind: NotFound, message: "No such file or directory" }', render/src/font.rs:55:68
stack backtrace:
0: rust_begin_unwind
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
2: core::result::unwrap_failed
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1749:5
3: core::result::Result<T,E>::expect
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1022:23
4: pdf_render::font::StandardCache::new
at /Users/omkarpatil/experiments/ghostscript/pdf_render/render/src/font.rs:55:20
5: pdf_render::cache::Cache::new
at /Users/omkarpatil/experiments/ghostscript/pdf_render/render/src/cache.rs:54:18
6: pdf2image::main
at ./src/main.rs:37:21
7: core::ops::function::FnOnce::call_once
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
PDF: https://arxiv.org/pdf/2002.10413.pdf
Page: 3 (0 indexed)
The differences are the thick edges (transparency) and the small arrows (position). You can find the call for the left thick edge on the first Backend.draw (matrix(0.87888 0 0 0.87888 127.801 71.99902)
), and the arrow (in front of "standard message") has a transformation matrix of matrix(0.87888 0.18372811 -0.18372811 0.87888 127.801 71.99902)
.
cargo update
cargo build --workspace
this is how far I can go (-_-)
Compiling pathfinder_view v0.1.1 (https://github.com/s3bk/pathfinder_view#4c3b70be)
For more information about this error, try `rustc --explain E0080`.
error: could not compile `pdf_encoding` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error[E0432]: unresolved import `winit::platform::run_return`
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:5:23
|
5 | use winit::platform::{run_return::EventLoopExtRunReturn};
| ^^^^^^^^^^ could not find `run_return` in `platform`
error[E0308]: mismatched types
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/view.rs:20:44
|
19 | match (event.state, modifiers.control_key(), event.physical_key) {
| ---------------------------------------------------------- this expression has type `(ElementState, bool, PhysicalKey)`
20 | (ElementState::Pressed, false, KeyCode::PageDown) => ctx.next_page(),
| ^^^^^^^^^^^^^^^^^ expected `PhysicalKey`, found `KeyCode`
error[E0308]: mismatched types
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/view.rs:21:44
|
19 | match (event.state, modifiers.control_key(), event.physical_key) {
| ---------------------------------------------------------- this expression has type `(ElementState, bool, PhysicalKey)`
20 | (ElementState::Pressed, false, KeyCode::PageDown) => ctx.next_page(),
21 | (ElementState::Pressed, false, KeyCode::PageUp) => ctx.prev_page(),
| ^^^^^^^^^^^^^^^ expected `PhysicalKey`, found `KeyCode`
error[E0308]: mismatched types
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/view.rs:22:43
|
19 | match (event.state, modifiers.control_key(), event.physical_key) {
| ---------------------------------------------------------- this expression has type `(ElementState, bool, PhysicalKey)`
...
22 | (ElementState::Pressed, true, KeyCode::Digit1) => ctx.zoom_by(0.2),
| ^^^^^^^^^^^^^^^ expected `PhysicalKey`, found `KeyCode`
error[E0308]: mismatched types
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/view.rs:23:43
|
19 | match (event.state, modifiers.control_key(), event.physical_key) {
| ---------------------------------------------------------- this expression has type `(ElementState, bool, PhysicalKey)`
...
23 | (ElementState::Pressed, true, KeyCode::Digit2) => ctx.zoom_by(-0.2),
| ^^^^^^^^^^^^^^^ expected `PhysicalKey`, found `KeyCode`
error[E0308]: mismatched types
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/view.rs:24:43
|
19 | match (event.state, modifiers.control_key(), event.physical_key) {
| ---------------------------------------------------------- this expression has type `(ElementState, bool, PhysicalKey)`
...
24 | (ElementState::Pressed, true, KeyCode::Digit0) => ctx.set_zoom(DEFAULT_SCALE),
| ^^^^^^^^^^^^^^^ expected `PhysicalKey`, found `KeyCode`
error[E0599]: no method named `supports_transparency` found for enum `glutin::config::Config` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:61:49
|
61 | let transparency_check = config.supports_transparency().unwrap_or(false)
| ^^^^^^^^^^^^^^^^^^^^^ method not found in `Config`
|
::: /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-0.31.3/src/config.rs:57:8
|
57 | fn supports_transparency(&self) -> Option<bool>;
| --------------------- the method is available for `glutin::config::Config` here
|
= help: items from traits can only be used if the trait is in scope
help: trait `GlConfig` which provides `supports_transparency` is implemented but not in scope; perhaps you want to import it
|
2 + use glutin::config::GlConfig;
|
error[E0599]: no method named `supports_transparency` found for enum `glutin::config::Config` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:62:30
|
62 | & !accum.supports_transparency().unwrap_or(false);
| ^^^^^^^^^^^^^^^^^^^^^ method not found in `Config`
|
::: /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-0.31.3/src/config.rs:57:8
|
57 | fn supports_transparency(&self) -> Option<bool>;
| --------------------- the method is available for `glutin::config::Config` here
|
= help: items from traits can only be used if the trait is in scope
help: trait `GlConfig` which provides `supports_transparency` is implemented but not in scope; perhaps you want to import it
|
2 + use glutin::config::GlConfig;
|
error[E0599]: no method named `num_samples` found for enum `glutin::config::Config` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:64:49
|
64 | if transparency_check || config.num_samples() > accum.num_samples() {
| ^^^^^^^^^^^ method not found in `Config`
|
::: /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-0.31.3/src/config.rs:46:8
|
46 | fn num_samples(&self) -> u8;
| ----------- the method is available for `glutin::config::Config` here
|
= help: items from traits can only be used if the trait is in scope
help: trait `GlConfig` which provides `num_samples` is implemented but not in scope; perhaps you want to import it
|
2 + use glutin::config::GlConfig;
|
error[E0599]: no method named `num_samples` found for enum `glutin::config::Config` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:64:71
|
64 | if transparency_check || config.num_samples() > accum.num_samples() {
| ^^^^^^^^^^^ method not found in `Config`
|
::: /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-0.31.3/src/config.rs:46:8
|
46 | fn num_samples(&self) -> u8;
| ----------- the method is available for `glutin::config::Config` here
|
= help: items from traits can only be used if the trait is in scope
help: trait `GlConfig` which provides `num_samples` is implemented but not in scope; perhaps you want to import it
|
2 + use glutin::config::GlConfig;
|
error[E0308]: mismatched types
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:58:73
|
58 | let (mut window, gl_config) = display_builder.build(event_loop, template_builder, |configs| {
| ----- ^^^^^^^^^^^^^^^^ expected `glutin::config::ConfigTemplateBuilder`, found `ConfigTemplateBuilder`
| |
| arguments to this method are incorrect
|
= note: `ConfigTemplateBuilder` and `glutin::config::ConfigTemplateBuilder` have similar names, but are actually distinct types
note: `ConfigTemplateBuilder` is defined in crate `glutin`
--> /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-0.30.10/src/config.rs:91:1
|
91 | pub struct ConfigTemplateBuilder {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `glutin::config::ConfigTemplateBuilder` is defined in crate `glutin`
--> /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-0.31.3/src/config.rs:91:1
|
91 | pub struct ConfigTemplateBuilder {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `glutin` are being used?
note: method defined here
--> /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-winit-0.4.2/src/lib.rs:89:12
|
89 | pub fn build<T, Picker>(
| ^^^^^
error[E0599]: no method named `display` found for enum `glutin::config::Config` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:76:36
|
76 | let gl_display = gl_config.display();
| ^^^^^^^ method not found in `Config`
|
::: /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-0.31.3/src/display.rs:146:8
|
146 | fn display(&self) -> Self::Target;
| ------- the method is available for `glutin::config::Config` here
|
= help: items from traits can only be used if the trait is in scope
help: trait `GetGlDisplay` which provides `display` is implemented but not in scope; perhaps you want to import it
|
2 + use glutin::display::GetGlDisplay;
|
error[E0599]: no method named `display` found for enum `glutin::config::Config` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:83:23
|
83 | gl_config.display().create_window_surface(&gl_config, &attrs).unwrap()
| ^^^^^^^ method not found in `Config`
|
::: /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glutin-0.31.3/src/display.rs:146:8
|
146 | fn display(&self) -> Self::Target;
| ------- the method is available for `glutin::config::Config` here
|
= help: items from traits can only be used if the trait is in scope
help: trait `GetGlDisplay` which provides `display` is implemented but not in scope; perhaps you want to import it
|
2 + use glutin::display::GetGlDisplay;
|
error[E0599]: no method named `set_inner_size` found for struct `winit::window::Window` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:138:25
|
138 | self.window.set_inner_size(PhysicalSize::new(size.x() as u32, size.y() as u32));
| ^^^^^^^^^^^^^^
|
help: there is a method `inner_size` with a similar name, but with different arguments
--> /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/window.rs:746:5
|
746 | pub fn inner_size(&self) -> PhysicalSize<u32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:75:43
|
75 | let window = crate::gl::GlWindow::new(&event_loop, item.title(), window_size, &config);
| ------------------------ ^^^^^^^^^^^ expected `&EventLoop<_>`, found `&Result<EventLoop<_>, EventLoopError>`
| |
| arguments to this function are incorrect
|
= note: expected reference `&EventLoop<_>`
found reference `&Result<EventLoop<_>, EventLoopError>`
note: associated function defined here
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/gl.rs:45:12
|
45 | pub fn new<T>(event_loop: &EventLoop<T>, title: String, window_size: Vector2F, config: &Config) -> Self {
| ^^^ -------------------------
error[E0599]: no method named `create_proxy` found for enum `Result` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:84:28
|
84 | let proxy = event_loop.create_proxy();
| ^^^^^^^^^^^^ method not found in `Result<EventLoop<_>, EventLoopError>`
|
note: the method `create_proxy` exists on the type `EventLoop<_>`
--> /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/event_loop.rs:253:5
|
253 | pub fn create_proxy(&self) -> EventLoopProxy<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider using `Result::expect` to unwrap the `EventLoop<_>` value, panicking if the value is a `Result::Err`
|
84 | let proxy = event_loop.expect("REASON").create_proxy();
| +++++++++++++++++
error[E0599]: no method named `run_return` found for enum `Result` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:90:16
|
90 | event_loop.run_return(move |event, _, control_flow| {
| -----------^^^^^^^^^^ method not found in `Result<EventLoop<_>, EventLoopError>`
error[E0599]: no variant or associated item named `RedrawRequested` found for enum `Event` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:98:20
|
98 | Event::RedrawRequested(_) => {
| ^^^^^^^^^^^^^^^ variant or associated item not found in `Event<_>`
error[E0599]: no variant or associated item named `MainEventsCleared` found for enum `Event` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:113:20
|
113 | Event::MainEventsCleared => item.idle(&mut ctx),
| ^^^^^^^^^^^^^^^^^ variant or associated item not found in `Event<_>`
error[E0599]: no variant or associated item named `LoopDestroyed` found for enum `Event` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:175:20
|
175 | Event::LoopDestroyed => {
| ^^^^^^^^^^^^^ variant or associated item not found in `Event<_>`
error[E0026]: variant `ScaleFactorChanged` does not have a field named `new_inner_size`
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:116:69
|
116 | WindowEvent::ScaleFactorChanged { scale_factor, new_inner_size: PhysicalSize { width, height } } => {
| ^^^^^^^^^^^^^^
| |
| variant `ScaleFactorChanged` does not have this field
| help: `ScaleFactorChanged` has a field named `inner_size_writer`
error[E0027]: pattern does not mention field `inner_size_writer`
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:116:21
|
116 | WindowEvent::ScaleFactorChanged { scale_factor, new_inner_size: PhysicalSize { width, height } } => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `inner_size_writer`
|
help: include the missing field in the pattern
|
116 | WindowEvent::ScaleFactorChanged { scale_factor, new_inner_size: PhysicalSize { width, height }, inner_size_writer } => {
| ~~~~~~~~~~~~~~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
116 | WindowEvent::ScaleFactorChanged { scale_factor, new_inner_size: PhysicalSize { width, height }, .. } => {
| ~~~~~~
error[E0599]: no variant or associated item named `Exit` found for enum `winit::event_loop::ControlFlow` in the current scope
--> /Users/john/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/4c3b70b/src/show.rs:188:42
|
188 | *control_flow = ControlFlow::Exit;
| ^^^^ variant or associated item not found in `ControlFlow`
|
note: if you're trying to build a new `winit::event_loop::ControlFlow`, consider using `winit::event_loop::ControlFlow::wait_duration` which returns `winit::event_loop::ControlFlow`
--> /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/event_loop.rs:187:5
|
187 | pub fn wait_duration(timeout: Duration) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Some errors have detailed explanations: E0026, E0027, E0308, E0432, E0599.
For more information about an error, try `rustc --explain E0026`.
error: could not compile `pathfinder_view` (lib) due to 23 previous errors
error: failed to run custom build command for `khronos-egl v6.0.0`
Caused by:
process didn't exit successfully: `/Users/john/Workspace/pdf_render/target/debug/build/khronos-egl-ce619f09250c05a8/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=EGL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=EGL_STATIC
cargo:rerun-if-env-changed=EGL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at /Users/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/khronos-egl-6.0.0/build.rs:10:14:
called `Result::unwrap()` on an `Err` value:
pkg-config exited with status code 1
> PKG_CONFIG_PATH=/opt/homebrew/Cellar/libepoxy/1.5.10/lib/pkgconfig:/opt/homebrew/Cellar/libepoxy/1.5.10/lib/pkgconfig:/usr/local/lib/pkgconfig: PKG_CONFIG_LIBDIR=/opt/homebrew/Cellar/libepoxy/1.5.10/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/lib/pkgconfig: PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags egl egl >= 1
The system library `egl` required by crate `khronos-egl` was not found.
The file `egl.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
PKG_CONFIG_PATH contains the following:
- /opt/homebrew/Cellar/libepoxy/1.5.10/lib/pkgconfig
- /opt/homebrew/Cellar/libepoxy/1.5.10/lib/pkgconfig
- /usr/local/lib/pkgconfig
-
HINT: you may need to install a package such as egl, egl-dev or egl-devel.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', view/src/bin/view.rs:11:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error should be clearer, e.g. "You must provide path to pdf to view"
Hey,
I just tried this out with a random PDF from my download folder, and there seem to be a couple of issues: https://leica-camera.com/sites/default/files/pm-73760-Leica-SL2_Technical-Data_en.pdf
First page (pdf_render, evince):
The first issue is in the title. Analyzing the PDF in Master PDF editor, one can see that there is the text "DAS WESENTLICHE" but with clipping path and white font behind the "LEICA SL2" text. So the clipping did not work in pdf_render.
The technical drawings are also present thrice, but two copies are clipped (I think).
Another image (pdf_render, evice):
In this picture, I see two issues: Missing special characters (e.g. TM), and missing gray outlines of text hanging over the gray box. These outlines are created by "Stroke Text" (opposed to normal "Fill Text", at least that is term Master PDF uses).
The camera body is too dark (the texture is still there, but I have to increase brightness to see it). Also, there is a gray line around the left and top border of the image (not visible at every zoom level).
zoomed out (pdf_render, evice):
I think when you zoom out far, you are supposed to render certain lines at a width of at least 1px per PDF specification.
MIT license but some or all fonts you say to use have a license (GPL) that is extremely incompatible with permissively licensed software.
There is an exception for embedding in a document but not for use in an application.
strings d050000l.pfb | head -10
%!PS-AdobeFont-1.0: Dingbats 001.005
%%CreationDate: Tue Oct 19 1999
% Copyright URW Software, Copyright 1997 by URW
% URW Software, Copyright 1997 by URW
% See the file COPYING (GNU General Public License) for license conditions.
% As a special exception, permission is granted to include this font
% program in a Postscript or PDF file that consists of a document that
% contains text to be displayed or printed using this font, regardless
% of the conditions or license applying to the document itself.
12 dict begin
The 14 Adobe fonts are free to embed but not to use in software as well.
There are likely metric compatible fonts which have a legitimate license.
pdf_render/render/src/textstate.rs
Lines 138 to 143 in 29c268f
I presume a span.text.push(' ');
is missing here. Adding it fixes the lack of spaces for me, but I am not sure if its the correct way.
I tried to test this out on a book (first pdf file I tried). The first three pages where fine, but on the fourth page I got this:
Finished release [optimized] target(s) in 0.16s
Running `target/release/view /home/daniel/docs/code/go.pdf`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Try { file: "render/src/renderstate.rs", line: 227, column: 29, context: Context([]), source: Other { msg: "expected 3 color arguments, got [Number(0.061)]" } }', /home/daniel/proj/rs-pdf/pdf_render/view/src/lib.rs:47:76
stack backtrace:
0: rust_begin_unwind
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
2: core::result::unwrap_failed
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1785:5
3: <pdf_view::PdfView<B> as pathfinder_view::view::Interactive>::scene
4: pathfinder_view::show::show::{{closure}}
5: winit::platform_impl::platform::x11::EventLoop<T>::run_return
6: pathfinder_view::show::show
7: view::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
missing fonts:
Here's a full backtrace:
stack backtrace:
0: 0x558f8e172a3d - std::backtrace_rs::backtrace::libunwind::trace::h22893a5306c091b4
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x558f8e172a3d - std::backtrace_rs::backtrace::trace_unsynchronized::h29c3bc6f9e91819d
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x558f8e172a3d - std::sys_common::backtrace::_print_fmt::he497d8a0ec903793
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:66:5
3: 0x558f8e172a3d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c2a9d2774d81873
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:45:22
4: 0x558f8e19523c - core::fmt::write::hba4337c43d992f49
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/fmt/mod.rs:1194:17
5: 0x558f8e16f891 - std::io::Write::write_fmt::heb73de6e02cfabed
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/io/mod.rs:1655:15
6: 0x558f8e174515 - std::sys_common::backtrace::_print::h63c8b24acdd8e8ce
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:48:5
7: 0x558f8e174515 - std::sys_common::backtrace::print::h426700d6240cdcc2
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:35:9
8: 0x558f8e174515 - std::panicking::default_hook::{{closure}}::hc9a76eed0b18f82b
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:295:22
9: 0x558f8e1741c9 - std::panicking::default_hook::h2e88d02087fae196
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:314:9
10: 0x558f8e174a62 - std::panicking::rust_panic_with_hook::habfdcc2e90f9fd4c
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:698:17
11: 0x558f8e174947 - std::panicking::begin_panic_handler::{{closure}}::he054b2a83a51d2cd
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:588:13
12: 0x558f8e172ef4 - std::sys_common::backtrace::__rust_end_short_backtrace::ha48b94ab49b30915
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:138:18
13: 0x558f8e174679 - rust_begin_unwind
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
14: 0x558f8dc768f3 - core::panicking::panic_fmt::h366d3a309ae17c94
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
15: 0x558f8dc769e3 - core::result::unwrap_failed::hddd78f4658ac7d0f
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1785:5
16: 0x558f8de1e786 - <pdf_view::PdfView<B> as pathfinder_view::view::Interactive>::scene::h8b7dd69dfdb0b391
17: 0x558f8de23fb8 - pathfinder_view::show::show::{{closure}}::h547afd43c791e3d8
18: 0x558f8de16ce7 - winit::platform_impl::platform::x11::EventLoop<T>::run_return::h8241d74d0f13d5c5
19: 0x558f8dc7eef9 - pathfinder_view::show::show::h1903cbab3e784b5a
20: 0x558f8dd590ce - view::main::h6329ec99029927c8
21: 0x558f8dd65133 - std::sys_common::backtrace::__rust_begin_short_backtrace::hc0669745f611c36c
22: 0x558f8dce7b09 - std::rt::lang_start::{{closure}}::h55713de905b4b591
23: 0x558f8e169cae - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::had4f69b3aefb47a8
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:259:13
24: 0x558f8e169cae - std::panicking::try::do_call::hf2ad5355fcafe775
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
25: 0x558f8e169cae - std::panicking::try::h0a63ac363423e61e
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
26: 0x558f8e169cae - std::panic::catch_unwind::h18088edcecb8693a
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
27: 0x558f8e169cae - std::rt::lang_start_internal::{{closure}}::ha7dad166dc711761
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:48
28: 0x558f8e169cae - std::panicking::try::do_call::hda0c61bf3a57d6e6
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
29: 0x558f8e169cae - std::panicking::try::hbc940e68560040a9
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
30: 0x558f8e169cae - std::panic::catch_unwind::haed0df2aeb3fa368
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
31: 0x558f8e169cae - std::rt::lang_start_internal::h9c06694362b5b80c
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:20
32: 0x558f8dd59242 - main
33: 0x7f7aad3d9290 - <unknown>
34: 0x7f7aad3d934a - __libc_start_main
35: 0x558f8dc76b95 - _start
at /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115
36: 0x0 - <unknown>
I get the message "missing fonts:", so it looks like the font instructions don't provide all of the fonts necessary to view my desired content. This should be easy to fix with some extra fonts right? I noticed that there's a download_fonts.sh
file but it doesn't generate the fonts.json
file needed by pathfinder or whatever it's called so I'm not sure what that's for.
Please let me know of a solution because I need to make a pdf viewer and if this doesn't work then I'll have to do it in C++.
This happens with multiple files. I'm testing with PDF files that contain embedded raster images. Some of them seem to work fine though.
This line, cargo said that points
is private.
pdf_render/render/src/graphicsstate.rs
Line 83 in a57d54f
Build error is occurred.
error[E0599]: no method named `points` found for reference `&Contour` in the current scope
--> /root/.cargo/git/checkouts/pdf_render-56211f49c16f7190/a57d54f/render/src/graphicsstate.rs:83:50
|
83 | let clip_polygon = outer_contour.points();
| ^^^^^^ private field, not a method
For more information about this error, try `rustc --explain E0599`.
error: could not compile `pdf_render` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
I think this error is meaning using pub(carte)
item. let see below.
https://github.com/s3bk/pathfinder/blob/bb4792c3b04be6bc05848534dc924946d60fd142/content/src/outline.rs#L44
Please, help me.
The pathfinder seems not well maintained for years, Vello looks like the future, I am wondering if you plan to do this job.
Hi I am running into the following build error
error[E0080]: could not evaluate static initializer
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/num/nonzero.rs:335:21
|
= note: entering unreachable code
|
note: inside `NonZero::<u32>::new_unchecked`
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/num/nonzero.rs:335:21
note: inside `Entry::new`
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pdf_encoding-0.3.0/src/lib.rs:154:17
|
154 | NonZeroU32::new_unchecked(c as u32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `c`
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pdf_encoding-0.3.0/src/lib.rs:168:10
|
168 | Some(Entry::new(c))
| ^^^^^^^^^^^^^
note: inside `WINANSI`
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pdf_encoding-0.3.0/src/cp1252.rs:2:2
|
2 | c('\u{0000}'), c('\u{0001}'), c('\u{0002}'), c('\u{0003}'), c('\u{0004}'), c('\u{0005}'), c('\u{0006}'), c('\u{0007}'),
| ^^^^^^^^^^^^^
error[E0080]: could not evaluate static initializer
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/num/nonzero.rs:335:21
|
= note: entering unreachable code
|
note: inside `NonZero::<u32>::new_unchecked`
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/num/nonzero.rs:335:21
note: inside `Entry::new`
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pdf_encoding-0.3.0/src/lib.rs:154:17
|
154 | NonZeroU32::new_unchecked(c as u32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `c`
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pdf_encoding-0.3.0/src/lib.rs:168:10
|
168 | Some(Entry::new(c))
| ^^^^^^^^^^^^^
note: inside `MACROMAN`
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pdf_encoding-0.3.0/src/macroman.rs:2:2
|
2 | c('\u{0000}'), c('\u{0001}'), c('\u{0002}'), c('\u{0003}'), c('\u{0004}'), c('\u{0005}'), c('\u{0006}'), c('\u{0007}'),
| ^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0080`.
error: could not compile `pdf_encoding` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
What could be going on? What are steps to move forward?
error[E0308]: mismatched types
--> render/src/fontentry.rs:144:57
|
144 | if let Some(transcoder) = source.to(dest) {
| -- ^^^^ expected `pdf_encoding::Encoding`, found a different `pdf_encoding::Encoding`
| |
| arguments to this method are incorrect
|
= note: `pdf_encoding::Encoding` and `pdf_encoding::Encoding` have similar names, but are actually distinct types
````
It's hard to find the crate, please lead us to it …
Tried running the pdf_text example, the cargo build fails pointing out that we are indeed using two different versions of the pdf package. The cargo tree traceback is as follows:
cargo tree --depth 3 | grep 'pdf'
results in
├── pdf v0.9.0
│ ├── pdf_derive v0.2.0 (proc-macro)
└── pdf_text v0.1.0 (https://github.com/pdf-rs/pdf_text.git#03d4789b)
├── font v0.1.0 (https://github.com/pdf-rs/font#9aa9b821)
│ ├── pdf_encoding v0.4.0
├── pdf v0.9.0 (https://github.com/pdf-rs/pdf#b06cfdf1)
│ ├── pdf_derive v0.2.0 (proc-macro) (https://github.com/pdf-rs/pdf#b06cfdf1)
├── pdf_render v0.1.0 (https://github.com/pdf-rs/pdf_render#39a877d3)
│ ├── font v0.1.0 (https://github.com/pdf-rs/font#9aa9b821) (*)
│ ├── pdf v0.9.0 (https://github.com/pdf-rs/pdf#b06cfdf1) (*)
│ ├── pdf_encoding v0.4.0 (*)
This can avoided by using mulitple locations feature for
Line 24 in 39a877d
to
pdf = { path = "../pdf/pdf", default-features=false, version = "0.9.0" }
I am very new to rust 🦀, please let me know if I missed anything.
Hi, I'm trying to compile this project with cargo +nightly build --bin view --release
but I get the following errors:
error[E0432]: unresolved import `pdf::font::ToUnicodeMap`
--> render/src/fontentry.rs:4:42
|
4 | use pdf::font::{Font as PdfFont, Widths, ToUnicodeMap};
| ^^^^^^^^^^^^ no `ToUnicodeMap` in `font`
error[E0432]: unresolved import `pdf::content::TextDrawAdjusted`
--> render/src/renderstate.rs:7:5
|
7 | use pdf::content::TextDrawAdjusted;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TextDrawAdjusted` in `content`
error[E0599]: no method named `transpose` found for enum `Option<&pdf::object::Stream>` in the current scope
--> render/src/fontentry.rs:29:52
|
29 | let mut to_unicode = pdf_font.to_unicode().transpose().unwrap();
| ^^^^^^^^^ method not found in `Option<&pdf::object::Stream>`
|
= note: the method was found for
- `Option<Result<T, E>>`
Which looks like there are some missing types in the pdf
library, even though I'm using the same Cargo.lock
from master.
There are a lot of CJK CMaps, but some of them are just Utf16-BE. We can check the prefix of unknown encoding and treat the encoding begin with Uni
as Utf16-BE.
Here are some information from pdf v1.5 spec p404
// fontentry.rs
let source_encoding = match base_encoding {
Some(BaseEncoding::StandardEncoding) => Some(Encoding::AdobeStandard),
Some(BaseEncoding::SymbolEncoding) => Some(Encoding::AdobeSymbol),
Some(BaseEncoding::WinAnsiEncoding) => Some(Encoding::WinAnsiEncoding),
Some(BaseEncoding::MacRomanEncoding) => Some(Encoding::MacRomanEncoding),
Some(BaseEncoding::MacExpertEncoding) => Some(Encoding::AdobeExpert),
ref e => {
// we can do the check here, return AdobeStandard if matches.
warn!("unsupported pdf encoding {:?}", e);
None
}
};
Hi, I'm getting this when I'm trying to compile. Please help.
Caused by:
failed to read C:\Users\user\projects\pathfinder_rasterize\Cargo.toml
The following code has a tiny misalignment:
pdf_render/render/src/textstate.rs
Line 139 in 406ccc0
In case of space, both word and char spacing should be added.
This issue is very simialr to jrmuizel/pdf-extract#35, which was fixed in jrmuizel/pdf-extract@271b616
error[E0432]: unresolved import winit::platform::unix
--> /Users/ihoey/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/559f5cc/src/show.rs:13:58
|
13 | use winit::platform::{run_return::EventLoopExtRunReturn, unix::EventLoopExtUnix};
| ^^^^ could not find unix
in platform
error[E0599]: no function or associated item named new_any_thread
found for struct EventLoop<_>
in the current scope
--> /Users/ihoey/.cargo/git/checkouts/pathfinder_view-e3bb902cdb8b6e4b/559f5cc/src/show.rs:78:37
|
78 | let mut event_loop = EventLoop::new_any_thread();
| ^^^^^^^^^^^^^^ function or associated item not found in EventLoop<_>
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try rustc --explain E0432
.
error: could not compile pathfinder_view
due to 2 previous errors
--- stderr
thread 'main' panicked at 'called Result::unwrap()
on an Err
value: "pkg-config" "--libs" "--cflags" "egl" "egl >= 1"
did not exit successfully: exit status: 1
error: could not find system library 'egl' required by the 'khronos-egl' crate
--- stderr
Package egl was not found in the pkg-config search path.
Perhaps you should add the directory containing egl.pc' to the PKG_CONFIG_PATH environment variable No package 'egl' found Package egl was not found in the pkg-config search path. Perhaps you should add the directory containing
egl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'egl' found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.