PejmanNik / jikji

Effortless report generator and reporting tools with React and NodeJS
https://jikji.xyz
MIT License
45 stars 1 forks source link

Generates blank page in PDF #8

Closed sharathm89 closed 1 year ago

sharathm89 commented 1 year ago

The below creates a Cover page with background image (Later i'll put some title and other information on it)

It shows perfectly on website but when pdf is generated it creates an emtpy page after the cover page.

Attaching the website image and pdf generated.

import { Image, usePageInfo } from "@jikji/react";

function Cover() {
  const { pageDimension } = usePageInfo();

  return (
    <ReportView>
      <ReportRoot>

        <Section dimension={pageSize.A4}>
          <PageContent>
            <div style={{ height: pageDimension.height }}>
              <Image
                width="100%"
                height="100%"
                src="https://images.unsplash.com/photo-1514888286974-6c03e2ca1dba"
              />
              </div>
          </PageContent>
        </Section>

      </ReportRoot>
    </ReportView>
  );
}

export default Cover;

Website Result

Screenshot 2023-06-16 at 12 09 51 PM

PDF Generated using @jikji/generator

out.pdf

PejmanNik commented 1 year ago

Hi, yes it seems it is caused by the change of behavior in browsers (or I don't know why), but you can use a custom size to page size and use a smaller size than the actual Page standard. you can use this file as a reference. It will be fixed in the next version

https://github.com/PejmanNik/jikji/blob/add-e2e-tests/packages/react/src/core/pageConst.ts