Code Monkey home page Code Monkey logo

Comments (6)

lillallol avatar lillallol commented on September 24, 2024

@pocketcap

I pushed an update to fix the bug in one of the dependencies of the package. Uninstall and then re install outline-pdf-cjs. Check if it solves your issue and let me know.

from outline-pdf-cjs.

pocketcap avatar pocketcap commented on September 24, 2024

@lillallol I tried, but still same.

Btw, that's how I have code as:

const { outlinePdfCjs } = require("@lillallol/outline-pdf-cjs");

async function creatOutlines() {
  await outlinePdfCjs({
      loadPath: "in.pdf",
      savePath: "outout.pdf",
      // first column  : page number
      //                 negative for collapsing outline
      // second column : outline depth
      // third column  : outline title
      outline: `
          1||Title 1
          2|-|Title 2
          -3|--|Title 3
          4|---|Title 4
          5|---|Title 5
          6|-|Title 6
          7||Title 7
      `,
  });
}

creatOutlines();

from outline-pdf-cjs.

lillallol avatar lillallol commented on September 24, 2024

@pocketcap

I updated the package dependencies so it should work now. So uninstall the package and install it again. If the problem persists let me know.

from outline-pdf-cjs.

pocketcap avatar pocketcap commented on September 24, 2024

@lillallol Thanks for fixing it. Yeah, I tried the new package, and it does solve the issue.
But I got new error if title number is larger than page number. Say I have 5 pages in PDF, but I have 7 titles specified. It give me error:

(node:21344) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'objectNumber' of undefined
    at PDFContext.assign (C:\git\formio-sql-service\node_modules\pdf-lib\cjs\core\PDFContext.js:34:17)
    at Object.applyOutlineToPdf (C:\git\formio-sql-service\node_modules\@lillallol\outline-pdf-cjs\node_modules\@lillallol\outline-pdf\dist\outlinePdf\outlinePdfFactory.js:84:29)
    at outlinePdfCjs (C:\git\formio-sql-service\node_modules\@lillallol\outline-pdf-cjs\dist\index.js:21:16)
    at async creatOutlines (C:\git\formio-sql-service\src\test\outline.js:4:3)

from outline-pdf-cjs.

lillallol avatar lillallol commented on September 24, 2024

@pocketcap

I made some changes. Now it should work. Uninstal and reinstall and then let me know if it fixes your issue.

from outline-pdf-cjs.

pocketcap avatar pocketcap commented on September 24, 2024

@lillallol It's working great now~ Thanks!

from outline-pdf-cjs.

Related Issues (3)

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.