Skip to content
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

Apple M1/M2 processors can't generate PDF's #77

Open
ducho opened this issue May 4, 2023 · 1 comment
Open

Apple M1/M2 processors can't generate PDF's #77

ducho opened this issue May 4, 2023 · 1 comment

Comments

@ducho
Copy link

ducho commented May 4, 2023

Hi! I'm trying to integrate your library into a project, but without success. Even though request and response are working fine, but I'm getting empty PDFs. I tried to change the PdfStorageType in the configuration to local, the html file was saved, but the pdf was not. My current config:

web_pdf:
    container_name: web_pdf_storage
    image: ptcos/pdf-storage
    ports:
      - '5001:5000'
    platform: linux/amd64
    environment:
      ASPNETCORE_ENVIRONMENT: Development
      BaseUrl: http://localhost:5000/
    volumes:
      - ../cdn/data:/data
      - ./docker/appsettings.json:/app/appsettings.json
    networks:
      - satur-proxy

appsettings.json

{
  "DbType": "inMemory",
  "MqType": "inMemory",
  "PdfStorageType": "inMemory",
  "LocalStorage": {
    "Folder": "/data"
  },
  "ApiAuthentication": {
    "Keys": [ "apikeyfortesting" ]
  },
  "Hangfire": {
    "AllowedIpAddresses": ["*"]
  }
}

response

array:1 [▼
  0 => array:5 [▼
    "pdfUri" => "http://localhost:5000/v1/pdf/guide/409338d8fed44790b6cdaa9946e7aac3.pdf"
    "htmlUri" => "http://localhost:5000/v1/pdf/guide/409338d8fed44790b6cdaa9946e7aac3.html"
    "id" => "409338d8fed44790b6cdaa9946e7aac3"
    "groupId" => "guide"
    "data" => []
  ]
]

curl

curl \
  --compressed \
  --request POST \
  --url 'http://web_pdf_storage:5000/v1/pdf/guide' \
  --header 'Authorization: ApiKey apikeyfortesting' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json-patch+json' \
  --header 'User-Agent: Symfony HttpClient/Curl' \
  --header 'Accept-Encoding: gzip' \
  --header 'Content-Length: 5117' \
  --data '{"html":"\u003Chtml lang=\u0022en\u0022\u003E\n\u003Chead\u003E\n    \u003Cmeta charset=\u0022utf-8\u0022\u003E\n    \u003Cmeta name=\u0022viewport\u0022 content=\u0022width=device-width, initial-scale=1\u0022\u003E\n    \u003Ctitle\u003EBootstrap demo\u003C\/title\u003E\n    \u003Clink href=\u0022https:\/\/cdn.jsdelivr.net\/npm\/[email protected]\/dist\/css\/bootstrap.min.css\u0022 rel=\u0022stylesheet\u0022 integrity=\u0022sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65\u0022 crossorigin=\u0022anonymous\u0022\u003E\n    \u003Clink rel=\u0022stylesheet\u0022 href=\u0022styles.css\u0022\u003E\n\u003C\/head\u003E\n\u003Cbody\u003E\n\u003Cnav class=\u0022navbar navbar-expand-lg navbar-dark bg-dark\u0022\u003E\n    \u003Cdiv class=\u0022container\u0022\u003E\n        \u003Ca class=\u0022navbar-brand\u0022 href=\u0022#\u0022\u003ENavbar\u003C\/a\u003E\n        \u003Cbutton class=\u0022navbar-toggler\u0022 type=\u0022button\u0022 data-bs-toggle=\u0022collapse\u0022 data-bs-target=\u0022#navbarSupportedContent\u0022 aria-controls=\u0022navbarSupportedContent\u0022 aria-expanded=\u0022false\u0022 aria-label=\u0022Toggle navigation\u0022\u003E\n            \u003Cspan class=\u0022navbar-toggler-icon\u0022\u003E\u003C\/span\u003E\n        \u003C\/button\u003E\n        \u003Cdiv class=\u0022collapse navbar-collapse\u0022 id=\u0022navbarSupportedContent\u0022\u003E\n            \u003Cul class=\u0022navbar-nav me-auto mb-2 mb-lg-0\u0022\u003E\n                \u003Cli class=\u0022nav-item\u0022\u003E\n                    \u003Ca class=\u0022nav-link active\u0022 aria-current=\u0022page\u0022 href=\u0022#\u0022\u003EHome\u003C\/a\u003E\n                \u003C\/li\u003E\n                \u003Cli class=\u0022nav-item\u0022\u003E\n                    \u003Ca class=\u0022nav-link\u0022 href=\u0022#\u0022\u003ELink\u003C\/a\u003E\n                \u003C\/li\u003E\n                \u003Cli class=\u0022nav-item dropdown\u0022\u003E\n                    \u003Ca class=\u0022nav-link dropdown-toggle\u0022 href=\u0022#\u0022 id=\u0022navbarDropdown\u0022 role=\u0022button\u0022 data-bs-toggle=\u0022dropdown\u0022 aria-expanded=\u0022false\u0022\u003E\n                        Dropdown\n                    \u003C\/a\u003E\n                    \u003Cul class=\u0022dropdown-menu\u0022 aria-labelledby=\u0022navbarDropdown\u0022\u003E\n                        \u003Cli\u003E\u003Ca class=\u0022dropdown-item\u0022 href=\u0022#\u0022\u003EAction\u003C\/a\u003E\u003C\/li\u003E\n                        \u003Cli\u003E\u003Ca class=\u0022dropdown-item\u0022 href=\u0022#\u0022\u003EAnother action\u003C\/a\u003E\u003C\/li\u003E\n                        \u003Cli\u003E\u003Chr class=\u0022dropdown-divider\u0022\u003E\u003C\/li\u003E\n                        \u003Cli\u003E\u003Ca class=\u0022dropdown-item\u0022 href=\u0022#\u0022\u003ESomething else here\u003C\/a\u003E\u003C\/li\u003E\n                    \u003C\/ul\u003E\n                \u003C\/li\u003E\n                \u003Cli class=\u0022nav-item\u0022\u003E\n                    \u003Ca class=\u0022nav-link disabled\u0022\u003EDisabled\u003C\/a\u003E\n                \u003C\/li\u003E\n            \u003C\/ul\u003E\n            \u003Cform class=\u0022d-flex\u0022 role=\u0022search\u0022\u003E\n                \u003Cinput class=\u0022form-control me-2\u0022 type=\u0022search\u0022 placeholder=\u0022Search\u0022 aria-label=\u0022Search\u0022\u003E\n                \u003Cbutton class=\u0022btn btn-outline-success\u0022 type=\u0022submit\u0022\u003ESearch\u003C\/button\u003E\n            \u003C\/form\u003E\n        \u003C\/div\u003E\n    \u003C\/div\u003E\n\u003C\/nav\u003E\n\n\u003Cdiv class=\u0022container my-5\u0022\u003E\n    \u003Ch1\u003EHello, world!\u003C\/h1\u003E\n    \u003Cdiv class=\u0022col-lg-8 px-0\u0022\u003E\n        \u003Cp class=\u0022fs-5\u0022\u003EYou\u0027ve successfully loaded up the Bootstrap starter example. It includes \u003Ca href=\u0022https:\/\/getbootstrap.com\/\u0022\u003EBootstrap 5\u003C\/a\u003E via the \u003Ca href=\u0022https:\/\/www.jsdelivr.com\/package\/npm\/bootstrap\u0022\u003EjsDelivr CDN\u003C\/a\u003E and includes an additional CSS and JS file for your own code.\u003C\/p\u003E\n        \u003Cp\u003EFeel free to download or copy-and-paste any parts of this example.\u003C\/p\u003E\n\n        \u003Chr class=\u0022col-1 my-4\u0022\u003E\n\n        \u003Ca href=\u0022https:\/\/getbootstrap.com\u0022 class=\u0022btn btn-primary\u0022\u003ERead the Bootstrap docs\u003C\/a\u003E\n        \u003Ca href=\u0022https:\/\/github.com\/twbs\/examples\u0022 class=\u0022btn btn-secondary\u0022\u003EView on GitHub\u003C\/a\u003E\n    \u003C\/div\u003E\n\u003C\/div\u003E\n\n\u003Cscript src=\u0022https:\/\/cdn.jsdelivr.net\/npm\/[email protected]\/dist\/js\/bootstrap.bundle.min.js\u0022 integrity=\u0022sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK\/7HAuoJl+0I4\u0022 crossorigin=\u0022anonymous\u0022\u003E\u003C\/script\u003E\n\u003Cscript src=\u0022main.js\u0022\u003E\u003C\/script\u003E\n\u003C\/body\u003E\n\u003C\/html\u003E","baseData":{},"rowData":[{}]}'
@ducho
Copy link
Author

ducho commented May 4, 2023

The problem is only with the Apple M1/M2 processors

@ducho ducho changed the title Empty zero bytes PDF Apple M1/M2 processors can't generate PDF's May 4, 2023
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

No branches or pull requests

1 participant