liady / chatgpt-pdf Goto Github PK
View Code? Open in Web Editor NEWA Chrome extension for downloading your ChatGPT history to PNG, PDF or a sharable link
License: MIT License
A Chrome extension for downloading your ChatGPT history to PNG, PDF or a sharable link
License: MIT License
The latest version of the plugin, v1.3.4 is not working in chrome v108: clicking buttons (PDF/PNG) is doing nothing.
Uncaught TypeError: Cannot read properties of null (reading 'style')
at Elements.fixLocation (content_script.js:200:17)
at downloadThread (content_script.js:112:12)
at downloadButton.onclick (content_script.js:89:5)
fixLocation @ content_script.js:200
downloadThread @ content_script.js:112
downloadButton.onclick @ content_script.js:89
firefox-chatgpt-share-v1.3.2.zip
according to the "Install to Firefox" instructions#1 0ms Starting document clone with size 1617x714 scrolled to 0,0 html2canvas.min.js:20:191994
SecurityError: The operation is insecure. html2canvas.min.js:20
FireFox Developer Edition, 108.0b6 (64-bit)
(macOS Monterey)
Additionally, "Share Link" is broken in a different way:
TypeError: NetworkError when attempting to fetch resource. content_script.js:207:35
That link calls https://chatgpt-static.s3.amazonaws.com/url.txt
which does work from a different tab in the same browser.
This follows a couple moments later:
Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: moz-extension://9f591789-ad54-4a2a-bf8f-43b3890db7c3/scripts/jspdf.umd.min.js
Source Map URL: jspdf.umd.min.js.map
Can't install Firefox extensions as appears to be corrupt
Once files are extracted and loading unpacked in chrome extension, extension does not work , there are some files missing in the extracted files..
There is a small offset in the top of every paragraph when exporting. Probably an issue with html2canvas
as well
hi, i really love this extension. thanks for the efforts.
it would be really helpful if the text and code in the pdf were capable of being selected and copied.
thanks
Can u add support for BingGPT? Thanks in advance
It worked for a few hours. Now the buttons don't show up anymore :(
Thanks for your work!
all the buttons including Regenerate just keep flashing - going crazy
@D-32 @liady @adrianmarinwork it is important to note that the current implementation of the code uploads data to the author's S3 bucket. While this may be a convenient solution for the author, it poses a potential security risk, as it could allow the author to access sensitive data, such as passwords or API keys, that users may inadvertently include in their data.
To address this concern, it would be advisable to modify the code so that it does not upload user data to a third-party service, such as the author's S3 bucket. One potential solution could be to modify the code so that it saves the user's data locally on their own machine instead of uploading it to a remote server. This would help ensure that the user's data remains secure and under their control.
It is important to be mindful of potential security risks when using third-party software or services. Users should always carefully review the code and configuration of any software or service they use, and take appropriate steps to secure their data and systems.
It looks like the shouldRemoveButton
function was broken with the latest webpage.
Can you add a search feature as well in the extension?
Using your excellent extension set me thinking about whether the apps Pandoc and PagedJS I have been experimenting with in book publication might be helpful. I've attached notes about them over the last couple of years which might be useful for you in addressing problems with layout and conversion to nicely paginated pdfs.
Paged.js.pdf
Pandoc & PanWriter.pdf
Zettlr - Pagedjs.pdf
I try the extension in Chroma and Firefox, nothing, doesn't work at all : for PDF, PNG, .. , NAda!
I installed the extension as per the instructions to take pdf of an existing conversation. The buttons are not visible in the conversation but they are present in a new chatGPT tab.
The buttons remain flashing even when GPT is done generating a response. Any ideas? Using on latest version of Chrome
The addition of Markdown would be essential for many when being utilized for writing documentation and providing/consuming code samples.
Thanks for the work on this!!
The new buttons (PNG, PDF) doesn't appear.
Edge is up to date.
See the exchange here.
In summary and inter alia:
Possibly related to this old (too short) query here.
I'm able to generate the PDF and PNG image only at ones, for the second time it gives the errors as
Uncaught TypeError: Cannot read properties of null (reading 'style') at Elements.fixLocation (content_script.js:201:17) at downloadThread (content_script.js:112:12) at downloadButton.onclick (content_script.js:89:5)
and
content_script.js:201 Uncaught TypeError: Cannot read properties of null (reading 'style') at Elements.fixLocation (content_script.js:201:17) at downloadThread (content_script.js:112:12) at downloadPdfButton.onclick (content_script.js:97:5)
I followed the instructions, the extension got installed. I can see buttons at the bottom of the chat. However, none of the buttons seems to be working - all they do is to create some weird selection around the chat name on the left side of the page.
When I go into extensions -> ChatGPT Download -> Errors, I see this:
Uncaught TypeError: Cannot read properties of null (reading 'style')
Context
https://chat.openai.com/chat/8ed2ef99-1915-41e1-a985-4cfe41efe8ad
Stack Trace
content_script.js:200 (anonymous function)
ChatGPT Jan 30 Version. Free Research Preview. Our goal is to make AI systems more natural and safe to interact with. Your feedback will help us improve.
I use ChatGPT in dark mode.
Browser: Vivaldi 5.6.2867.62 (Stable channel) (32-bit)
Windows 10 Version 22H2 (Build 19045.2486)
ChatGPT Download 1.3.4
Uncaught TypeError: Cannot read properties of null (reading 'style')
at Elements.fixLocation (content_script.js:200:17)
at downloadThread (content_script.js:112:12)
at downloadButton.onclick (content_script.js:89:5)
Currently getting this error in Dev console for v1.3.4. I am using Brave Browser.
content_script.js:201 Uncaught TypeError: Cannot read properties of null (reading 'style')
at Elements.fixLocation (content_script.js:201:17)
at downloadThread (content_script.js:112:12)
at downloadButton.onclick (content_script.js:89:5)
I've extracted the content related to obtaining the canvas and downloading it from the source code, creating a runnable Chrome DevTools code snippet.
PS:
class Elements {
constructor() {
this.init();
}
init() {
// this.threadWrapper = document.querySelector(".cdfdFe");
this.spacer = document.querySelector(
".w-full.h-32.md\\:h-48.flex-shrink-0"
);
this.thread = document.querySelector(
"[class*='react-scroll-to-bottom']>[class*='react-scroll-to-bottom']>div"
);
this.positionForm = document.querySelector("form").parentNode;
// this.styledThread = document.querySelector("main");
// this.threadContent = document.querySelector(".gAnhyd");
this.scroller = Array.from(
document.querySelectorAll('[class*="react-scroll-to"]')
).filter((el) => el.classList.contains("h-full"))[0];
this.hiddens = Array.from(document.querySelectorAll(".overflow-hidden"));
this.images = Array.from(document.querySelectorAll("img[srcset]"));
}
fixLocation() {
this.hiddens.forEach((el) => {
el.classList.remove("overflow-hidden");
});
this.spacer.style.display = "none";
this.thread.style.maxWidth = "960px";
this.thread.style.marginInline = "auto";
this.positionForm.style.display = "none";
this.scroller.classList.remove("h-full");
this.scroller.style.minHeight = "100vh";
this.images.forEach((img) => {
const srcset = img.getAttribute("srcset");
img.setAttribute("srcset_old", srcset);
img.setAttribute("srcset", "");
});
//Fix to the text shifting down when generating the canvas
document.body.style.lineHeight = "0.5";
}
restoreLocation() {
this.hiddens.forEach((el) => {
el.classList.add("overflow-hidden");
});
this.spacer.style.display = null;
this.thread.style.maxWidth = null;
this.thread.style.marginInline = null;
this.positionForm.style.display = null;
this.scroller.classList.add("h-full");
this.scroller.style.minHeight = null;
this.images.forEach((img) => {
const srcset = img.getAttribute("srcset_old");
img.setAttribute("srcset", srcset);
img.setAttribute("srcset_old", "");
});
document.body.style.lineHeight = null;
}
}
const Format = {
PNG: "png",
PDF: "pdf",
};
function downloadThread({ as = Format.PNG } = {}) {
const elements = new Elements();
elements.fixLocation();
const pixelRatio = window.devicePixelRatio;
// since I only need to export to image format, following two lines code mean less
const minRatio = as === Format.PDF ? 2 : 2.5;
window.devicePixelRatio = Math.max(pixelRatio, minRatio);
html2canvas(elements.thread, {
letterRendering: true,
}).then(async function (canvas) {
elements.restoreLocation();
window.devicePixelRatio = pixelRatio;
const imgData = canvas.toDataURL("image/png");
requestAnimationFrame(() => {
if (as === Format.PDF) {
return handlePdf(imgData, canvas, pixelRatio);
} else {
handleImg(imgData);
}
});
});
}
function handleImg(imgData) {
const binaryData = atob(imgData.split("base64,")[1]);
const data = [];
for (let i = 0; i < binaryData.length; i++) {
data.push(binaryData.charCodeAt(i));
}
const blob = new Blob([new Uint8Array(data)], { type: "image/png" });
const url = URL.createObjectURL(blob);
window.open(url, "_blank");
const a = document.createElement("a");
a.href = url;
a.download = "chat-gpt-image.png";
a.click();
}
// since I only need to export to image format, following two lines code mean less
// if you wanna to export to pdf file, import pdfjs lib before everything, otherwise you will get an error about 'operty 'jsPDF' of 'window.jspdf' as it is undefined.
function handlePdf(imgData, canvas, pixelRatio) {
const { jsPDF } = window.jspdf;
const orientation = canvas.width > canvas.height ? "l" : "p";
var pdf = new jsPDF(orientation, "pt", [
canvas.width / pixelRatio,
canvas.height / pixelRatio,
]);
var pdfWidth = pdf.internal.pageSize.getWidth();
var pdfHeight = pdf.internal.pageSize.getHeight();
pdf.addImage(imgData, "PNG", 0, 0, pdfWidth, pdfHeight);
pdf.save("chat-gpt.pdf");
}
downloadThread();
Probably an issue with html2canvas
, but avatar images sometime lose their size and shown distorted in the export
The way this extension currently works, when someone clicks the Share Link or Download PDF buttons the full conversation log is uploaded to an Amazon S3 container and set to public. This all happens through a function hosted at https://chat-gpt-static.netlify.app/.netlify/functions/chatgpt-upload which we are unable to see the code for.
In addition to the above, the way this function is referenced is through a text file also hosted on Amazon S3. The owner of the chatgpt-static S3 container on AWS could change the contents of the url.txt file (https://chatgpt-static.s3.amazonaws.com/url.txt) at any time to include a malicious script, which poses another serious security issue, on top of the one above.
Further, since the full conversation log is uploaded to an S3 container and set to public, with no way for us to delete the data. If someone happens to have some personal or other potentially harmful information in the conversation log being uploaded, then that poses a serious public safety issue on top of the security issue.
I would highly recommend you come up with a more direct and local way to achieve the same goals in light of the major issues above.
Unpacking the extension on Windows won't work since filenames with colons that aren't supported.
Chrome addon does not work - The below error is thrown on Console log:
Uncaught TypeError: Cannot read properties of null (reading 'style')
at Elements.fixLocation (content_script.js:200:17)
at downloadThread (content_script.js:112:12)
at downloadButton.onclick (content_script.js:89:5)
fixLocation @ content_script.js:200
downloadThread @ content_script.js:112
downloadButton.onclick @ content_script.js:89
72The resource <URL> was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.
content_script.js:200 Uncaught TypeError: Cannot read properties of null (reading 'style')
at Elements.fixLocation (content_script.js:200:17)
at downloadThread (content_script.js:112:12)
at downloadPdfButton.onclick (content_script.js:97:5)
fixLocation @ content_script.js:200
downloadThread @ content_script.js:112
downloadPdfButton.onclick @ content_script.js:97
content_script.js:275 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'cssRules')
at getCssFromSheet (content_script.js:275:27)
at getData (content_script.js:258:21)
at sendRequest (content_script.js:239:16)
at exportHtml.onclick (content_script.js:105:5)
getCssFromSheet @ content_script.js:275
getData @ content_script.js:258
sendRequest @ content_script.js:239
exportHtml.onclick @ content_script.js:105
Add a support for Firefox, I believe it is only changing the manifest file (since FF uses manifest v2)
The PDF is also PNG? I can't select the text... It's basically a useless function unless I'm doing something wrong
One idea ?
Uncaught TypeError: Cannot read properties of null (reading 'style')
Contexte
https://chat.openai.com/chat/63e96989-9867-452b-b9e5-187fba7d2c40
Trace de la pile
content_script.js:201 (fonction anonyme)
"Share link" export that looks okay: blob:https://chat.openai.com/fc3ae5ca-e4ad-4da2-b6b3-972182de6426
Using version 1.3.1.
Dear [ChatGPT Export and Share] Owner/Manager:
I'm the webmaster of the "GPT資源庫" website. I'm happy to reach out to you as we're building a website and would like to be able to use your company logo image as the featured image for our app assets.
Our website is an application resource display and screening website. We will select high-quality application resources to display on our website, and your company's Logo will be used to represent the quality and credibility of the application resources we recommend.
Furthermore, all application resources displayed on the website will be linked directly to your official website/application page, so that users can directly download or use your application, and our website will also insert advertisements for profit Purpose.
We will use your company logo image on this page:
https://chatgptdemo.com/product/chatgpt-export-and-share/
If you agree to us using your Logo, please let us know and feel free to contact me if you have any questions. We are willing to answer any questions about this application.
Thank you for your patience and look forward to hearing from you.
Congratulations,
"GPT資源庫" Webmaster
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.