mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
feat(csharp): creating and editing pdf instead docxf
This commit is contained in:
@ -1,10 +1,12 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
- csharp: filling by default
|
||||||
- csharp-mvc: filling by default
|
- csharp-mvc: filling by default
|
||||||
- java-spring: filling by default
|
- java-spring: filling by default
|
||||||
- php: filling by default
|
- php: filling by default
|
||||||
- python: filling by default
|
- python: filling by default
|
||||||
- ruby: filling by default
|
- ruby: filling by default
|
||||||
|
- csharp: creating and editing pdf instead docxf
|
||||||
- csharp-mvc: creating and editing pdf instead docxf
|
- csharp-mvc: creating and editing pdf instead docxf
|
||||||
- java-spring: creating and editing pdf instead docxf
|
- java-spring: creating and editing pdf instead docxf
|
||||||
- php: creating and editing pdf instead docxf
|
- php: creating and editing pdf instead docxf
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3c0-1.65685 1.34315-3 3-3h20l7 7v30c0 1.6569-1.3431 3-3 3H3c-1.65685 0-3-1.3431-3-3V3z" fill="#27ABA3"/><path d="M23 0l7 7h-4c-1.6569 0-3-1.34315-3-3V0z" fill="#008078"/><path fill-rule="evenodd" clip-rule="evenodd" d="M24 14H6v7h18v-7zm-.8182 5.9978H6.81818V15H23.1818v4.9978zM24 23H6v7h18v-7zm-.8182 5.9978H6.81818V24H23.1818v4.9978z" fill="#fff"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 463 B |
@ -0,0 +1,5 @@
|
|||||||
|
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M0 3C0 1.34315 1.34315 0 3 0H23L30 7V37C30 38.6569 28.6569 40 27 40H3C1.34315 40 0 38.6569 0 37V3Z" fill="#9E1919"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.0062 15V16.0065H24V15H17.0062ZM17.0062 19V20.0163H24V19H17.0062ZM24 23H17.0062V24.0261H24V23ZM6 28V27.0293H24V28H6ZM7 16H14V23H7V16ZM6 15H7H14H15V16V23V24H14H7H6V23V16V15Z" fill="white"/>
|
||||||
|
<path d="M23 0L30 7H26C24.3431 7 23 5.65685 23 4V0Z" fill="black" fill-opacity="0.25"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 558 B |
@ -0,0 +1 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 1h8l4 4v10H2V1z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5l-4-4H2v14h12V5zm-4-5l5 5v11H1V0h9z" fill="#BFBFBF"/><path fill="#9E1919" d="M3 10h10v4H3z"/><path d="M7 7V2H3v5h4zM8 3V2h2v1H8zM8 5V4h5v1H8zM13 6H8v1h5V6zM13 8H3v1h10V8z" fill="#BFBFBF"/><path opacity=".3" d="M9 1h1v3h4l1 1H9V1z" fill="#333"/></svg>
|
||||||
|
After Width: | Height: | Size: 441 B |
@ -172,7 +172,7 @@ label .checkbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.try-editor.form {
|
.try-editor.form {
|
||||||
background-image: url("images/file_docxf.svg");
|
background-image: url("images/file_pdf.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-option {
|
.side-option {
|
||||||
@ -540,6 +540,11 @@ footer a:hover {
|
|||||||
background-image: url("images/icon_pptx.svg");
|
background-image: url("images/icon_pptx.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stored-edit.pdf,
|
||||||
|
.uploadFileName.pdf {
|
||||||
|
background-image: url("images/icon_pdf.svg");
|
||||||
|
}
|
||||||
|
|
||||||
.stored-edit span {
|
.stored-edit span {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
|
|||||||
@ -83,7 +83,7 @@
|
|||||||
<a class="try-editor slide" data-type="slide">Presentation</a>
|
<a class="try-editor slide" data-type="slide">Presentation</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="try-editor form" data-type="docxf">PDF form</a>
|
<a class="try-editor form" data-type="pdf">PDF form</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<label class="side-option">
|
<label class="side-option">
|
||||||
@ -229,11 +229,13 @@
|
|||||||
<img src="app_themes/images/mobile.svg" alt="Open in editor for mobile devices" title="Open in editor for mobile devices"/>
|
<img src="app_themes/images/mobile.svg" alt="Open in editor for mobile devices" title="Open in editor for mobile devices"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="contentCells contentCells-icon">
|
<% if (docType != "pdf") { %>
|
||||||
<a href="<%= editUrl + "&editorsType=desktop&editorsMode=comment" %>" target="_blank">
|
<td class="contentCells contentCells-icon">
|
||||||
<img src="app_themes/images/comment.svg" alt="Open in editor for comment" title="Open in editor for comment"/>
|
<a href="<%= editUrl + "&editorsType=desktop&editorsMode=comment" %>" target="_blank">
|
||||||
</a>
|
<img src="app_themes/images/comment.svg" alt="Open in editor for comment" title="Open in editor for comment"/>
|
||||||
</td>
|
</a>
|
||||||
|
</td>
|
||||||
|
<% } %>
|
||||||
<% if (docType == "word") { %>
|
<% if (docType == "word") { %>
|
||||||
<td class="contentCells contentCells-icon">
|
<td class="contentCells contentCells-icon">
|
||||||
<a href="<%= editUrl + "&editorsType=desktop&editorsMode=review" %>" target="_blank">
|
<a href="<%= editUrl + "&editorsType=desktop&editorsMode=review" %>" target="_blank">
|
||||||
|
|||||||
@ -250,6 +250,7 @@ namespace OnlineEditorsExample
|
|||||||
{
|
{
|
||||||
var ext = Path.GetExtension(fileName).ToLower();
|
var ext = Path.GetExtension(fileName).ToLower();
|
||||||
|
|
||||||
|
if (FormatManager.PdfExtensions().Contains(ext)) return "pdf"; // pdf for pdf extensions
|
||||||
if (FormatManager.DocumentExtensions().Contains(ext)) return "word"; // word for text document extensions
|
if (FormatManager.DocumentExtensions().Contains(ext)) return "word"; // word for text document extensions
|
||||||
if (FormatManager.SpreadsheetExtensions().Contains(ext)) return "cell"; // cell for spreadsheet extensions
|
if (FormatManager.SpreadsheetExtensions().Contains(ext)) return "cell"; // cell for spreadsheet extensions
|
||||||
if (FormatManager.PresentationExtensions().Contains(ext)) return "slide"; // slide for presentation extensions
|
if (FormatManager.PresentationExtensions().Contains(ext)) return "slide"; // slide for presentation extensions
|
||||||
|
|||||||
@ -135,14 +135,14 @@ namespace OnlineEditorsExample
|
|||||||
{
|
{
|
||||||
// create demo document of a specified file type
|
// create demo document of a specified file type
|
||||||
Try(type, Request["sample"], Request);
|
Try(type, Request["sample"], Request);
|
||||||
Response.Redirect("doceditor.aspx?fileID=" + HttpUtility.UrlEncode(FileName));
|
Response.Redirect("doceditor.aspx?editorsMode=edit&fileID=" + HttpUtility.UrlEncode(FileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
// get file extension
|
// get file extension
|
||||||
var ext = Path.GetExtension(FileName).ToLower();
|
var ext = Path.GetExtension(FileName).ToLower();
|
||||||
|
var canFill = _Default.FillFormsExts.Contains(ext);
|
||||||
// get editor mode or set the default one (edit)
|
// get editor mode or set the default one (edit)
|
||||||
var editorsMode = Request.GetOrDefault("editorsMode", "edit");
|
var editorsMode = Request.GetOrDefault("editorsMode", canFill ? "fillForms" : "edit");
|
||||||
|
|
||||||
var canEdit = _Default.EditedExts.Contains(ext); // check if this file can be edited
|
var canEdit = _Default.EditedExts.Contains(ext); // check if this file can be edited
|
||||||
var editorsType = Request.GetOrDefault("editorsType", "desktop");
|
var editorsType = Request.GetOrDefault("editorsType", "desktop");
|
||||||
@ -150,11 +150,11 @@ namespace OnlineEditorsExample
|
|||||||
var id = Request.Cookies.GetOrDefault("uid", null);
|
var id = Request.Cookies.GetOrDefault("uid", null);
|
||||||
var user = Users.getUser(id); // get the user
|
var user = Users.getUser(id); // get the user
|
||||||
|
|
||||||
if ((!canEdit && editorsMode.Equals("edit") || editorsMode.Equals("fillForms")) && _Default.FillFormsExts.Contains(ext)) {
|
if ((!canEdit && editorsMode.Equals("edit") || editorsMode.Equals("fillForms")) && canFill) {
|
||||||
editorsMode = "fillForms";
|
editorsMode = "fillForms";
|
||||||
canEdit = true;
|
canEdit = true;
|
||||||
}
|
}
|
||||||
var submitForm = editorsMode.Equals("fillForms") && id.Equals("uid-1"); // check if the Submit form button is displayed or hidden
|
var submitForm = (editorsMode.Equals("fillForms") || editorsMode.Equals("embedded")) && user.id.Equals("uid-1"); // check if the Submit form button is displayed or hidden
|
||||||
var mode = canEdit && editorsMode != "view" ? "edit" : "view"; // get the editor opening mode (edit or view)
|
var mode = canEdit && editorsMode != "view" ? "edit" : "view"; // get the editor opening mode (edit or view)
|
||||||
|
|
||||||
var jss = new JavaScriptSerializer();
|
var jss = new JavaScriptSerializer();
|
||||||
@ -489,8 +489,8 @@ namespace OnlineEditorsExample
|
|||||||
case "slide":
|
case "slide":
|
||||||
ext = ".pptx"; // .pptx for slide document type
|
ext = ".pptx"; // .pptx for slide document type
|
||||||
break;
|
break;
|
||||||
case "docxf":
|
case "pdf":
|
||||||
ext = ".docxf";
|
ext = ".pdf";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -150,6 +150,20 @@ namespace OnlineEditorsExample
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<string> PdfExtensions()
|
||||||
|
{
|
||||||
|
return Pdfs()
|
||||||
|
.Select(format => format.Extension())
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Format> Pdfs()
|
||||||
|
{
|
||||||
|
return All()
|
||||||
|
.Where(format => format.Type == "pdf")
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public static List<string> AllExtensions()
|
public static List<string> AllExtensions()
|
||||||
{
|
{
|
||||||
return All()
|
return All()
|
||||||
|
|||||||
Submodule web/documentserver-example/csharp/assets/document-formats updated: 730e13c89d...2b592018ad
Reference in New Issue
Block a user