diff --git a/pyhtml2pdf/converter.py b/pyhtml2pdf/converter.py
index 66a0841..1565361 100644
--- a/pyhtml2pdf/converter.py
+++ b/pyhtml2pdf/converter.py
@@ -117,7 +117,7 @@ def __get_pdf_from_html(
if isinstance(source, io.BytesIO):
encoded_content = base64.b64encode(source.getvalue()).decode("utf-8")
path = f"data:text/html;base64,{encoded_content}"
- if not source.startswith("http") and not source.startswith("file"):
+ elif not source.startswith("http") and not source.startswith("file"):
encoded_content = base64.b64encode(source.encode("utf-8")).decode("utf-8")
path = f"data:text/html;base64,{encoded_content}"
else: