Coder Social home page Coder Social logo

pdf.js's People

Contributors

fotoverite avatar izuzak avatar marak avatar mklabs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdf.js's Issues

Window resize displaces the currently viewed page

Settings:

  1. Zoom: Page Fit
  2. Hand tool enabled

Browser version:
Chrome - Version 65.0.3325.162 (Official Build) (64-bit)

Steps to reproduce the issue :

  1. Search for a word in pdf
  2. Once the search word is highlighted, Scroll page using hand tool to next page or more.
  3. Resize chrome window to a lower size

Expected Result
The PDF stays in currently viewed page.

Actual Result
PDF moves back to the last search result page

node-demo produces 2 blank pages

Using latest pdf.js - the one with drawLine...
With node.js v0.4.12, which might have something to do with it, the demo produces 2 blank pages; no text or graphics. Select All, copy, paste into a text doc pastes nothing. testFile57.pdf in the repo and download displays properly, select/copy/paste pastes the text into a text editor. Ubuntu Natty 11.04.

I note that in the repo/download file, the node version is v0.3.0-pre.

There are differences between the files:
testFile57:
%PDF-1.3

<>
BT /F1 16.00 Tf ET
BT 56.69 785.20 Td (hello, I am PDF.) Tj ET
BT 56.69 756.85 Td (i was created using node.js version: v0.3.0-pre) Tj ET
BT 56.69 728.50 Td (i can also be created from the browser) Tj ET

endstream
endobj

testFile44 (mine):
%PDF-1.3

<>
BT undefined 16.00 Tf ET
BT /F0 16.00 Tf ET
BT 56.69 785.20 Td (hello, I am PDF.) Tj ET
BT /F0 16.00 Tf ET
BT 56.69 756.85 Td (i was created using node.js version: v0.4.12) Tj ET
BT /F0 16.00 Tf ET
BT 56.69 728.50 Td (i can also be created from the browser) Tj ET

endstream
endobj

Similar block a bit later on - also has 'undefined'.

Update: I was able to get it to work:

  1. node-demo.js:
    var doc = new pdf();
    doc.setFont(1); //<<<< added to make sure fonts[] had 1 font
    doc.text(20, 20, 'hello, I am PDF.');
    doc.text(20, 30, 'i was created using node.js version: ' + process.version);
    doc.text(20, 40, 'i can also be created from the browser');
  2. pdf.js:
    var _addPage = function() {
    beginPage();
    // Set line width
    out(sprintf('%.2f w', (lineWidth * k)));
// 16 is the font size
pageFontSize = fontSize;
pageFont = font;
//DLC-->>>>>delete out('BT ' + fonts[font] + ' ' + parseInt(fontSize) + '.00 Tf ET');    
//fonts[] is undefined at this point when called by _addPage();

}

Alternately, rename setFont: function... to var _setFont = function... and move the function up where _addPage() is. Then create
setFont: function(f){
_setFont(f);
},
in its place. Then, where _addPage() is called to automatically create the first page, FIRST call
_setFont(1);

This change removes the need for node-demo.js to have an initializing call to setFont.

pdf.js does not lint

Hiya,

As a starting point for embracing an new project I always run the code trough JSLINT (http://jslint.com)
Well, It did not look pretty ;)
Will someone work with me to get this done? It is a good start to increase the maintainability off the project.
For now I don't have time for this, I will just quickly insert new-line handling, and some stuff to make it easier to set the position based on earlier outputs.

regards
Sander

Special Chars

How can I add special chars like (β) to the document?

UTF8 support

When adding text with some UTF8 characters it won't display them correctly.

E.g. ö becomes ö

Feature plans?

Could you please post some plans for what kinds of features you think you will implement? We have some forms and table-based reports generated by prawn that we would like to be able to render entirely on the client side with js. Thanks!

DOM or HTML => Post Script

We really need a way to transform DOM elements, or straight HTML text into Post Script.

Forcing the user to create a PDF using only Post Script notation is cruel.

Name conflicts with other project

The name "pdf.js" conflicts with Mozilla's PDF reader pdf.js, another GitHub project (and more popular than Marak/pdf.js).

I would suggest you change the name so that others can find you easier.
Perhaps "makepdf.js"?

Text wrapping

I would like to send add a long text with text function but the problem is whenever text is too long to be fitted in screen it is trimmed. Any idea how to add text with wrapping option?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.