Watermark generation method, proxy device, electronic device and storage medium

By adding a watermark to the proxy device and converting the file format, the problem of difficult to trace the source and download files in the prior art is solved, effectively trace the file and preventing the watermark from being deleted, without the need to modify the business system.

CN119004419BActive Publication Date: 2025-03-07BEIJING TRUSFORT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411479514.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-03-07
Estimated Expiration
2044-10-22

AI Technical Summary

Technical Problem

It is difficult for the prior art to effectively trace the downloaded PDF files without modifying the business system, especially when the files are transmitted, it is difficult to trace the specific disseminators.

Method used

By implementing the watermark generation method in the proxy device, in response to the browser's download request, the corresponding file is obtained, and user information is added to the file to generate a watermark. Export the watermark file to image format and convert it to the original file format to avoid being deleted by the PDF editor. Finally, the 302 command jump is made to ensure that the browser obtains the watermarked file from the proxy device.

Benefits of technology

It realizes traceability of downloaded files, ensuring that the watermark cannot be deleted through conventional PDF editing tools, and there is no need to modify the business system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119004419B_ABST
    Figure CN119004419B_ABST
Patent Text Reader

Abstract

The present disclosure provides a watermark generation method, an agent device, an electronic device and a storage medium, the method comprising: in response to receiving a download request sent by a browser, obtaining a first file corresponding to the download request from a server; adding a first watermark to the first file to obtain a first watermark file; the first watermark at least includes first user information; exporting the first watermark file as a second watermark file, and exporting the second watermark file as a third watermark file; the format of the second watermark file is an image format; determining a jump uniform resource locator based on the third watermark file, and sending a 302 instruction to the browser based on the jump uniform resource locator; in this way, it is possible to avoid the editor from deleting the watermark by deleting the layer, thereby improving the watermark anti-deletion capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a watermark generation method, an agent device, an electronic device and a storage medium. Background Art

[0002] When building a business system, people usually consider the functionality of the business system rather than its security. Many business systems have file download functions, such as downloading the address book of all employees of the unit, the unit's design drawings, financial statements, customer list information, etc. These data are usually stored in Portable Document Format (PDF) and are strictly prohibited from being leaked. If such information is found to be leaked, the unit also hopes to find the source and identify the specific person who leaked it, so as to facilitate subsequent accountability and education. Summary of the invention

[0003] The present disclosure provides a watermark generation method, an agent device, an electronic device and a storage medium to at least solve the above technical problems existing in the prior art.

[0004] According to a first aspect of the present disclosure, a watermark generation method is provided, which is implemented by an agent device, and the method includes:

[0005] In response to receiving a download request sent by a browser, obtaining a first file corresponding to the download request from a server; the download request includes information of a first user who logs in to the browser;

[0006] Adding a first watermark to the first file to obtain a first watermark file; the first watermark at least includes the first user information;

[0007] Exporting the first watermark file as a second watermark file, and exporting the second watermark file as a third watermark file; the format of the second watermark file is an image format, and the format of the third watermark file is the same as that of the first watermark file;

[0008] A jump uniform resource locator is determined based on the third watermark file, and a 302 instruction is sent to the browser based on the jump uniform resource locator to instruct the browser to obtain the third watermark file from the jump uniform resource locator.

[0009] In the above solution, the proxy device includes an authentication unit, and the method further includes:

[0010] The authentication unit performs authentication based on the authentication information sent by the browser;

[0011] In response to the authentication information being authenticated, the first user information logging into the browser is confirmed.

[0012] In the above solution, in response to receiving a download request sent by the browser, obtaining a first file corresponding to the download request from the server includes:

[0013] In response to confirming that the download request sent by the browser carries the first identifier, sending the download request to the server;

[0014] Acquire a first file corresponding to the download request from a server, and store the first file in a hard disk space corresponding to the proxy device;

[0015] The first identifier includes the format of the first file.

[0016] In the above solution, the step of adding the first watermark to the first file to obtain the first watermark file includes:

[0017] confirming whether the first file needs to be watermarked;

[0018] In response to the need to add a watermark to the first file, the first watermark is tiled in the first file to obtain a first watermark file.

[0019] In the above solution, the step of tiling the first watermark in the first file to obtain the first watermark file is implemented by a watermark unit inside the proxy device, and specifically includes:

[0020] The watermark unit confirms the watermark parameter, the first user information and the first file;

[0021] A first watermark is generated based on the watermark parameters and the first user information, and the first watermark is tiled in the first file.

[0022] In the above solution, after determining the jump uniform resource locator based on the third watermark file and sending a 302 instruction to the browser based on the jump uniform resource locator, the method further includes:

[0023] In response to receiving an access request from a browser for the jump uniform resource locator, acquiring the third watermark file from the watermark unit;

[0024] The third watermark file is sent to the browser.

[0025] According to a second aspect of the present disclosure, there is provided an agent device, the device comprising:

[0026] The proxy gateway unit is used to obtain a first file corresponding to the download request from the server in response to receiving a download request sent by the browser; the download link includes information of a first user who logs in to the browser;

[0027] a watermark unit, configured to add a first watermark to the first file to obtain a first watermark file; the first watermark includes at least the first user information; export the first watermark file to a second watermark file, and export the second watermark file to a third watermark file; the format of the second watermark file is an image format, and the format of the third watermark file is the same as that of the first watermark file;

[0028] The proxy gateway unit is further configured to determine a jump uniform resource locator based on the third watermark file, and send a 302 instruction to the browser based on the jump uniform resource locator to instruct the browser to obtain the third watermark file from the jump uniform resource locator.

[0029] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0030] at least one processor; and

[0031] a memory communicatively connected to the at least one processor; wherein,

[0032] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.

[0033] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.

[0034] The watermark generation method, proxy device, electronic device and storage medium disclosed in the present invention obtain the first file corresponding to the download request from the server in response to receiving the download request sent by the browser; the download request includes the first user information of logging into the browser; the first watermark is added to the first file to obtain the first watermark file; the first watermark includes at least the first user information; the first watermark file is exported as the second watermark file, and the second watermark file is exported as the third watermark file; the format of the second watermark file is an image format, and the format of the third watermark file is the same as that of the first watermark file; a jump uniform resource locator is determined based on the third watermark file, and a 302 instruction is sent to the browser based on the jump uniform resource locator to instruct the browser to obtain the third watermark file from the jump uniform resource locator. In this way, the file can be traced by generating a watermark through user information, and the added watermark is converted into an image format and then converted to the original format, which can avoid the watermark from being deleted.

[0035] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:

[0037] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0038] Figure 1 A first optional flow chart of the watermark generation method provided by the embodiment of the present disclosure is shown;

[0039] Figure 2 A schematic diagram of an agent device provided by an embodiment of the present disclosure is shown;

[0040] Figure 3 A second optional flow chart of the watermark generation method provided by the embodiment of the present disclosure is shown;

[0041] Figure 4 A third optional flow chart of the watermark generation method provided by the embodiment of the present disclosure is shown;

[0042] Figure 5 An optional structural diagram of an agent device provided in an embodiment of the present disclosure is shown;

[0043] Figure 6 A schematic diagram of an optional structure of an agent device provided in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0044] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0045] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0046] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein.

[0047] Unless otherwise defined, all technical and scientific terms used in this disclosure have the same meaning as those commonly understood by those skilled in the art to which this disclosure belongs. The terms used in this disclosure are only for the purpose of describing the embodiments of this disclosure and are not intended to limit this disclosure.

[0048] It should be understood that in the various embodiments of the present disclosure, the size of the serial number of each implementation process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.

[0049] Before further describing the embodiments of the present disclosure in detail, the nouns and terms involved in the embodiments of the present disclosure are described. The nouns and terms involved in the embodiments of the present disclosure are subject to the following interpretations.

[0050] 1) Party A: The party that issues the project contract, providing project funds and necessary project coordination.

[0051] 2) Party B: The contractor of the project, providing products and technical services.

[0052] 3) Business system: an information system that can provide necessary services to Party A, such as: OA system, financial system, customer management system, official website, etc. In the disclosed embodiment, the business system is the transformation object of Party B.

[0053] 4) B / S architecture: Browser / Server Architecture, that is, a browser-based system architecture. When users access the business system, they do not need to install other clients, only a browser is needed.

[0054] The problem solved by the embodiments of the present disclosure relates to a business system with a B / S architecture.

[0055] In the relevant technologies, the current requirements of companies / enterprises / organizations for document security include:

[0056] 1) Photos can be traced. The PDF (Portable Document Format) files downloaded by users can be traced to specific people, that is, the watermark in the file should be the information of a specific user. Generally, the watermark of the user appears on the file when the file is downloaded. In this way, when someone takes a photo to spread the content of the file, the source of the information can be traced back to the photo.

[0057] 2) Files sent out can be traced. PDF files are not editable, but there are dozens of PDF editors on the market, such as Adobe Acrobat. Some of these editors can not only edit text in PDF, but also add or delete watermarks. If users who download PDF documents use such tools to delete watermarks, the added watermarks cannot be traced.

[0058] 3) The business system needs to be transformed. The business system needs to provide source code and expand its functions on this basis. If multiple business systems need this function, each business system needs to be transformed, which is a huge project.

[0059] In related technologies, document traceability can include creator traceability or disseminator traceability. Usually, data traceability and copyright declaration can be performed by adding a watermark to the document. There are several methods:

[0060] 1) Add a watermark to the file before uploading it. Usually the watermark is the name of the uploader and other information.

[0061] 3) After the administrator or ordinary user uploads the file, the server will batch process and add a watermark, which is the company name and related information.

[0062] 3) Batch watermark the PDF files uploaded to the business system. The specific method is: copy multiple copies of a file, and then add a user's watermark to each copy according to the user list. When the user downloads, the watermarked PDF file corresponding to the current user is downloaded based on the request parameters, that is, the current user name or ID.

[0063] Combined with the current needs of companies / enterprises / organizations, the above method 1) only adds the uploader's information watermark, and cannot trace the downloader's dissemination, and cannot truly meet the needs; the above method 2) only adds company information, and cannot trace the downloader's dissemination, and cannot truly meet the needs; the above method 3) although it can trace the source, has two problems: first, each user needs to store a backup of the file on the server, which takes up a lot of space. If the administrator needs to delete the file in the management page, it is necessary to find all copies with watermarks. When adding or deleting users, it is also necessary to add new copies of all files or delete the copies of all files corresponding to the user; second, after the user downloads the corresponding file, the watermark can be easily deleted through PDF editing software.

[0064] In summary, the technical goals that need to be achieved are as follows:

[0065] 1) When each user downloads a PDF file, it should be able to be temporarily generated according to the current user's request;

[0066] 2) The generated watermark should be different from the ordinary watermark and cannot be removed by the watermark removal function of the PDF editing tool.

[0067] 3) No business system modification is required.

[0068] Based on this, the embodiments of the present disclosure provide a watermark generation method, which can overcome the defects existing in the related technology and achieve the above technical goals.

[0069] Figure 1 The first optional flow chart of the watermark generation method provided by the embodiment of the present disclosure is shown. Figure 2 A schematic diagram of an agent device provided by an embodiment of the present disclosure is shown.

[0070] Step S101, in response to receiving a download request sent by a browser, obtaining a first file corresponding to the download request from a server.

[0071] In some embodiments, the watermark generation method described in the present disclosure is implemented by an agent device, such as Figure 2 As shown, the proxy device is located between the browser and the server (or business system) and is used to forward and process data or files transmitted between the browser and the server.

[0072] In some embodiments, Figure 2As shown, the proxy device at least includes a proxy gateway unit and a watermark unit, wherein the proxy gateway unit is used to forward and process the data transmitted between the browser and the server; the watermark unit is used to process the files transmitted between the browser and the server. The proxy device can be a computer program, an electronic circuit, a database, a mobile application, an electronic device, a cloud computing platform, a distributed system, an artificial intelligence framework, a mathematical model, an automation tool, a microcontroller, etc., which can implement software or hardware of an algorithm or method flow.

[0073] In some embodiments, the proxy gateway unit, in response to receiving a download request sent by the browser, obtains a first file corresponding to the download request from a server, wherein the download request carries information of a first user who logs in to the browser; optionally, the proxy gateway unit stores the first file in a hard disk space corresponding to the proxy device.

[0074] The first user information may include at least one of the name, unique identification number, telephone number, initials and email address of the first user who logs into the browser. Optionally, the first user's Internet Protocol Address (IP address) when logging into the browser may also be included.

[0075] Step S102: adding a first watermark to the first file to obtain a first watermark file.

[0076] In some embodiments, the watermark unit generates a first watermark based on the first user information, and adds the first watermark to the first file to obtain a first watermark file. That is, the first watermark includes at least one of the first user's name, unique identification number, telephone number, initials and email address.

[0077] Step S103: export the first watermark file as a second watermark file, and export the second watermark file as a third watermark file.

[0078] In some embodiments, the watermark and the content are usually in two different layers. The PDF editor will separate the layer where the watermark is located from the layer where the content is located, and then delete the layer where the watermark is located to achieve the effect of removing the watermark. Therefore, in order to prevent this method from deleting the added watermark, in the embodiment of the present disclosure, the first watermark file will be exported as a second watermark file, and the format of the second watermark file is an image format, such as "JPG", "PNG", "GIF", "BMP", "TIF", etc.; then the second watermark file will be exported as a third watermark file, and the format of the third watermark file is the same as that of the first watermark file. In the second watermark file, the watermark and the content are in the same layer. After the second watermark file is exported as the third watermark file, the PDF editor cannot delete the watermark by separating the layers.

[0079] For example, if the format of the first watermark file is PDF, the first watermark file is exported as an image, and then the image is converted into PDF format to obtain the third watermark file; if the format of the first watermark file is "doc" or "docx", the content in the first watermark file is exported as at least one image by screenshot or the like, and then the image is reflected in the form of content in the word document to obtain the third watermark file.

[0080] Step S104: determining a jump uniform resource locator based on the third watermark file, and sending a 302 instruction to the browser based on the jump uniform resource locator.

[0081] In some embodiments, since the location and content of the file that the browser expects to download have changed, that is, it has been updated from being stored in the server to being stored in the hard disk space corresponding to the proxy device, and from the first file to the third watermark file, the original uniform resource locator (URL) has become invalid and a new URL, i.e. a jump uniform resource locator, needs to be provided.

[0082] In some embodiments, the proxy gateway unit determines a jump uniform resource locator and sends a 302 instruction to the browser, wherein the 302 instruction includes the jump uniform resource locator; after receiving the 302 instruction, the browser obtains a third watermark file from the jump uniform resource locator.

[0083] In this way, through the watermark generation method provided by the embodiment of the present disclosure, a watermark is generated according to user information and added to the file, which is convenient for subsequent tracing of the file; in addition, in the process of generating the watermark file, it is first exported to an image format, and then the watermark file in the image format is exported to the original format, which can avoid the editor deleting the watermark by deleting the layer, thereby improving the watermark anti-deletion capability; in addition, the addition of watermarks and file conversion are all implemented based on the proxy device, without the need to modify the client and server (business system).

[0084] Figure 3 A second optional flow chart of the watermark generation method provided in the embodiment of the present disclosure is shown, and will be explained according to each step.

[0085] Step S201: the authentication unit performs authentication based on the authentication information sent by the browser.

[0086] In some embodiments, the authentication unit receives authentication information sent by the browser, the authentication information including a user identity (user ID) and a corresponding password; performs authentication based on the user ID and the password; and confirms the user information of the user who logs into the browser in response to the authentication information passing the authentication. The user information includes at least one of the user's name, unique identification number, telephone number, initials, and email address.

[0087] Alternatively, in response to the authentication information failing to pass authentication, authentication failure information is returned to the browser.

[0088] Step S202: In response to receiving a download request sent by the browser, the proxy gateway unit obtains a first file corresponding to the download request from the server.

[0089] In some embodiments, the proxy gateway unit responds to the download request sent by the browser with a first identifier, sends the download request to the server, obtains the first file corresponding to the download request from the server, and stores the first file in the hard disk space corresponding to the proxy device. The first identifier includes the format of the first file.

[0090] In specific implementation, the proxy gateway unit can monitor the data sent by the browser, and after detecting a URL with a first identifier suffix, confirm that the download request sent by the browser has been received. The first identifier can include at least one of ".PDF", ".doc" and ".docx".

[0091] In some embodiments, for the company's already public files, such as company profiles, product introductions, etc., it is not necessary to add a watermark of the downloading user or the disseminating user. Only confidential files or files that need to be kept confidential need to add a watermark; the proxy gateway unit can confirm the confidentiality level of the first file, and confirm that the file with a confidentiality level greater than the preset level is the file that needs to be watermarked. The preset level can be determined according to actual needs.

[0092] In some embodiments, if the proxy gateway unit confirms that the first file needs to be watermarked, the watermark parameters, first user information and the first file are sent to the watermark unit; or, if the proxy gateway unit confirms that the first file does not need to be watermarked, the first file is sent to the browser.

[0093] Step S203: the watermark unit adds a first watermark to the first file to obtain a first watermark file.

[0094] In some embodiments, the watermark unit generates a first watermark based on the watermark parameters and the first user information, and lays the first watermark in the first file. The watermark parameters include at least one of watermark content, watermark style (such as font, font size, color and transparency), watermark position (such as horizontal center, vertical center, upper left corner, lower right corner, margin, etc.), watermark rotation angle and watermark density. The watermark content is the first user information.

[0095] Step S204: the watermark unit exports the first watermark file as a second watermark file, and exports the second watermark file as a third watermark file.

[0096] The specific steps of step S204 are the same as those of step S103 and will not be repeated here.

[0097] Step S205: determining a jump uniform resource locator based on the third watermark file, and sending a 302 instruction to the browser based on the jump uniform resource locator.

[0098] In some embodiments, since the location and content of the file that the browser expects to download have changed, that is, it is updated from being stored in the server to being stored in the hard disk space corresponding to the proxy device, and the first file is updated to the third watermark file, the original uniform resource locator is invalid and a new URL needs to be provided, that is, a jump uniform resource locator.

[0099] In some embodiments, the proxy gateway unit determines a jump uniform resource locator and sends a 302 instruction to the browser, wherein the 302 instruction includes the jump uniform resource locator; after receiving the 302 instruction, the browser obtains the third watermark file from the jump uniform resource locator. The 302 instruction is a status code in the HyperTextTransfer Protocol (HTTP), indicating "temporarily moved"; when the server returns a 302 instruction, it means that the requested resource (i.e., the first file) has been temporarily moved to another location. The browser needs to re-initiate a request to obtain the required resource based on the new location information returned by the server.

[0100] In some embodiments, during the execution of steps S202 to S204, the proxy gateway unit periodically confirms the generation progress of the third watermark file, and sends the generation progress of the third watermark file to the browser, so that the browser displays the generation progress of the third watermark file.

[0101] In some embodiments, after the proxy device generates the third watermark file, it can store the third watermark file in the hard disk space for a first duration, and delete the third watermark file after the storage time is greater than the first duration; optionally, after the proxy device receives the download request sent by the browser in step S202, it can confirm whether there is a third watermark file with a watermark generated in the hard disk space based on the first file and the first user information corresponding to the download request, and if so, directly send the third watermark file to the browser. In this way, when the user frequently downloads the first file within the first duration, there is no need to repeatedly perform operations such as obtaining from the server and adding watermarks, which improves the file output efficiency and releases processor resources.

[0102] In this way, through the watermark generation method provided by the embodiment of the present disclosure, a watermark is generated according to user information and added to the file, which is convenient for subsequent tracing of the file; in addition, in the process of generating the watermark file, it is first exported to an image format, and then the watermark file in the image format is exported to the original format, which can avoid the editor deleting the watermark by deleting the layer, thereby improving the watermark anti-deletion capability; in addition, the addition of watermarks and file conversion are all implemented based on the proxy device, without the need to modify the client and server (business system).

[0103] Figure 4 A third optional flow chart of the watermark generation method provided in the embodiment of the present disclosure is shown, and will be explained according to each step.

[0104] Step S301: The browser sends authentication information to the authentication unit.

[0105] In some embodiments, the browser receives a user ID and a password input by the user, and sends authentication information to the authentication unit based on the user ID and the password.

[0106] Step S302: the authentication unit performs authentication based on the authentication information sent by the browser.

[0107] In some embodiments, the authentication unit receives authentication information sent by the browser, the authentication information including a user ID and a corresponding password; performs authentication based on the user ID and password; and confirms user information of the user who logs into the browser in response to the authentication information passing the authentication. The user information includes at least one of a user's name, a unique identification number, a telephone number, an initial of the name, and an email address.

[0108] Alternatively, in response to the authentication information failing to pass authentication, authentication failure information is returned to the browser.

[0109] In some optional embodiments, in response to the authentication information being authenticated, the authentication unit confirms the access rights corresponding to the user ID and returns a list of applications with access rights to the browser. The browser accesses the business system based on the application list. At least one page of the business system includes a link to download a file.

[0110] In some embodiments, the browser initiates a data access request to the proxy gateway unit based on a user operation, the proxy gateway unit forwards the data access request to the server, receives a page returned by the server based on the data access request, and sends the page to the browser, wherein the page includes a link to download the file.

[0111] Step S303: In response to receiving the download request sent by the browser, the proxy gateway unit obtains the first file corresponding to the download request from the server.

[0112] In some embodiments, when a user needs to download a first file, he clicks on a hyperlink corresponding to the first file. In response to the user clicking on the hyperlink, the browser sends a download request to the proxy gateway unit. In response to the download request sent by the browser with a first identifier, the proxy gateway unit forwards the download request to the server, obtains the first file corresponding to the download request from the server, and stores the first file in the hard disk space corresponding to the proxy device. The first identifier includes the format of the first file. For example, the proxy gateway unit detects that the URL suffix has ".PDF".

[0113] In a specific implementation, the proxy gateway unit can detect the data sent by the browser, and after detecting a URL with a first identifier suffix, confirm that the download request sent by the browser has been received. The first identifier can include at least one of ".PDF", ".doc" and ".docx".

[0114] Step S304: the proxy gateway unit determines whether a watermark needs to be added to the first file.

[0115] In some embodiments, for the company's already public files, such as company profiles, product introductions, etc., it is not necessary to add a watermark of the downloading user or the disseminating user. Only confidential files or files that need to be kept confidential need to add a watermark; the proxy gateway unit can confirm the confidentiality level of the first file, and confirm that the file with a confidentiality level greater than the preset level is the file that needs to be watermarked. The preset level can be determined according to actual needs.

[0116] In some embodiments, if the proxy gateway unit confirms that the first file needs to be watermarked, the watermark parameters, first user information and the first file are sent to the watermark unit; or, if the proxy gateway unit confirms that the first file does not need to be watermarked, the first file is sent to the browser.

[0117] Step S305: The watermark unit adds a first watermark to the first file to obtain a first watermark file.

[0118] In some embodiments, the watermark unit converts the first file into a preset format, which may include a PDF file; generates a first watermark based on the watermark parameters and the first user information, and tiles the first watermark in the first file. The watermark parameters include at least one of watermark content, watermark style (such as font, font size, color and transparency), watermark position (such as horizontal center, vertical center, upper left corner, lower right corner, margin, etc.), watermark rotation angle and watermark density. The watermark content is the first user information.

[0119] Specifically, converting the first file into a preset format, namely a PDF file, can more conveniently add watermarks to files of various forms, and also expand the file download scope of the business system.

[0120] Step S306: The watermark unit exports the first watermark file as a second watermark file, and exports the second watermark file as a third watermark file.

[0121] In some embodiments, the watermark and the content are usually in two different layers. The PDF editor will separate the layer where the watermark is located from the layer where the content is located, and then delete the layer where the watermark is located to achieve the effect of removing the watermark. Therefore, in order to prevent this method from deleting the added watermark, in the embodiment of the present disclosure, the first watermark file will be exported as the second watermark file, and the format of the second watermark file is an image format, such as "JPG", "PNG", "GIF", "BMP", "TIF", etc.; then the second watermark file will be exported as the third watermark file, and the format of the third watermark file is the same as that of the first watermark file.

[0122] For example, if the format of the first watermark file is PDF, the first watermark file is exported as an image, and then the image is converted into PDF format to obtain the third watermark file; if the format of the first watermark file is "doc" or "docx", the content in the first watermark file is exported as at least one image by screenshot or the like, and then the image is reflected in the form of content in the word document to obtain the third watermark file.

[0123] In some embodiments, step S305 and step S306 may be implemented based on a function library such as pypdf2 of Python.

[0124] Step S307, 302 instruction redirects the URL.

[0125] In some embodiments, since the location and content of the file that the browser expects to download have changed, that is, it has been updated from being stored in the server to being stored in the hard disk space corresponding to the proxy device, and from the first file to the third watermark file, the original uniform resource locator (URL) has become invalid and a new URL, i.e. a jump uniform resource locator, needs to be provided.

[0126] In some embodiments, the proxy gateway unit determines a jump uniform resource locator and sends a 302 instruction to the browser, wherein the 302 instruction includes the jump uniform resource locator; after receiving the 302 instruction, the browser accesses the jump uniform resource locator to obtain a third watermark file.

[0127] In this way, through the watermark generation method provided by the embodiment of the present disclosure, after the user logs in, if a PDF file is downloaded from the business system, the proxy gateway unit first identifies the download link (URL suffix with .pdf), and then downloads the PDF file to the hard disk space where the proxy device is located. The watermark unit opens the PDF file and adds user information (user information comes from the proxy gateway unit) to tile the watermark, and then exports the watermarked PDF to a picture PDF. During this period, the user interface is displayed as a watermark generation waiting interface, and the watermark generation status is periodically polled. When the watermark service completes the PDF file watermark generation, it returns a 302 instruction to the client browser, jumps to the download of the generated watermarked picture-type PDF link, and after the user browser completes the download, a watermarked picture-type PDF is obtained, and the watermark is part of each page of the picture in the picture-type PDF. In this way, the user cannot delete the watermark through the PDF editing tool.

[0128] Figure 5 An optional structural diagram of an agent device provided in an embodiment of the present disclosure is shown, and will be described according to each part.

[0129] In some embodiments, the proxy device 400 includes a proxy gateway unit 401 and a watermark unit 402 .

[0130] The proxy gateway unit 401 is used to obtain a first file corresponding to the download request from a server in response to receiving a download request sent by a browser; the download request includes information of a first user who logs in to the browser;

[0131] The watermark unit 402 is used to add a first watermark to the first file to obtain a first watermark file; the first watermark includes at least the first user information; the first watermark file is exported as a second watermark file, and the second watermark file is exported as a third watermark file; the format of the second watermark file is an image format, and the format of the third watermark file is the same as that of the first watermark file;

[0132] The proxy gateway unit 401 is further configured to determine a jump uniform resource locator based on the third watermark file, and send a 302 instruction to the browser based on the jump uniform resource locator to instruct the browser to obtain the third watermark file from the jump uniform resource locator.

[0133] In some embodiments, the proxy device 400 may further include an authentication unit 403 .

[0134] The authentication unit 403 is used to perform authentication based on the authentication information sent by the browser;

[0135] In response to the authentication information being authenticated, the first user information logging into the browser is confirmed.

[0136] The proxy gateway unit 401 is specifically configured to send the download request to the server in response to confirming that the download request sent by the browser carries the first identifier;

[0137] Acquire a first file corresponding to the download request from a server, and store the first file in a hard disk space corresponding to the proxy device;

[0138] The first identifier includes the format of the first file.

[0139] The watermark unit 402 is specifically used to confirm whether the first file needs to be watermarked;

[0140] In response to the need to add a watermark to the first file, the first watermark is tiled in the first file.

[0141] The watermark unit 402 is specifically used for the watermark unit 402 to confirm the watermark parameters, the first user information and the first file;

[0142] A first watermark is generated based on the watermark parameters and the first user information, and the first watermark is tiled in the first file.

[0143] The proxy gateway unit 401, after determining a jump uniform resource locator based on the third watermark file and sending a 302 instruction to the browser based on the jump uniform resource locator, is further configured to obtain the third watermark file from the watermark unit 402 in response to receiving an access request from the browser for the jump uniform resource locator;

[0144] The third watermark file is sent to the browser.

[0145] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0146] Figure 6 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0147] like Figure 6 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0148] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0149] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the watermark generation method. For example, in some embodiments, the watermark generation method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the watermark generation method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the watermark generation method in any other appropriate manner (e.g., by means of firmware).

[0150] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0151] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0152] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0153] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0154] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0155] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0156] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0157] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0158] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A watermark generation method, characterized in that: The method is implemented by a proxy device, the proxy device is located between the browser and the server, and the method includes: In response to confirming that the download request sent by the browser carries a first identifier, the download request is sent to the server; a first file corresponding to the download request is obtained from the server, and the first file is stored in a hard disk space corresponding to the proxy device; the download request includes first user information for logging into the browser; the first identifier includes a format of the first file; Adding a first watermark to the first file to obtain a first watermark file; the first watermark at least includes the first user information; Export the first watermark file as a second watermark file, and export the second watermark file as a third watermark file; the format of the second watermark file is an image format, and the format of the third watermark file is the same as that of the first watermark file; specifically: if the format of the first watermark file is "doc" or "docx", export the content in the first watermark file as at least one image in the form of a screenshot, and then reflect the image in the form of content in a word document to obtain the third watermark file; Determine a jump uniform resource locator based on the third watermark file, and send a 302 instruction to the browser based on the jump uniform resource locator to instruct the browser to obtain the third watermark file from the jump uniform resource locator; The third watermark file is stored in the hard disk space for a first time period, and the third watermark file is deleted after the storage time is greater than the first time period; when a download request sent by the browser is received again, based on the first file and user information corresponding to the download request, it is confirmed whether there is a third watermark file with a watermark generated in the hard disk space, and if so, the third watermark file is directly sent to the browser.

2. The method according to claim 1, characterized in that The proxy device includes an authentication unit, and the method further includes: The authentication unit performs authentication based on the authentication information sent by the browser; In response to the authentication information being authenticated, the user information of the user logging into the browser is confirmed.

3. The method according to claim 1, characterized in that The adding a first watermark to the first file to obtain a first watermark file includes: confirming whether the first file needs to be watermarked; In response to the need to add a watermark to the first file, the first watermark is tiled in the first file.

4. The method according to claim 3, characterized in that The step of generating a first watermark based on the first user information and tiling the first watermark in the first file is implemented by a watermark unit inside the proxy device, specifically including: The watermark unit confirms the watermark parameter, the first user information and the first file; A first watermark is generated based on the watermark parameters and the first user information, and the first watermark is tiled in the first file.

5. The method according to claim 1, characterized in that After determining a jump uniform resource locator based on the third watermark file and sending a 302 instruction to the browser based on the jump uniform resource locator, the method further includes: In response to receiving an access request from a browser for the jump uniform resource locator, acquiring the third watermark file from the watermark unit; The third watermark file is sent to the browser.

6. A proxy device, characterized in that: The device comprises: The proxy gateway unit, in response to confirming that the download request sent by the browser contains a first identifier, sends the download request to the server; obtains a first file corresponding to the download request from the server, and stores the first file in a hard disk space corresponding to the proxy device; the download request includes first user information for logging into the browser; the first identifier includes a format of the first file; The watermark unit is used to add a first watermark to the first file to obtain a first watermark file; the first watermark includes at least the first user information; the first watermark file is exported as a second watermark file, and the second watermark file is exported as a third watermark file; the format of the second watermark file is an image format, and the format of the third watermark file is the same as that of the first watermark file; specifically: if the format of the first watermark file is "doc" or "docx", the content in the first watermark file is exported as at least one image in the form of a screenshot, and the image is then reflected in the word document in the form of content to obtain the third watermark file; The proxy gateway unit is further configured to determine a jump uniform resource locator based on the third watermark file, and send a 302 instruction to the browser based on the jump uniform resource locator to instruct the browser to obtain the third watermark file from the jump uniform resource locator; The proxy gateway unit is also used to store the third watermark file in the hard disk space for a first period of time, and delete the third watermark file after the storage time is greater than the first period of time; when receiving the download request sent by the browser again, based on the first file and user information corresponding to the download request, confirm whether there is a third watermark file with a watermark generated in the hard disk space, and if so, directly send the third watermark file to the browser.

7. The device according to claim 6, characterized in that The proxy device further includes an authentication unit, which is used to: Perform authentication based on the authentication information sent by the browser; In response to the authentication information being authenticated, the user information of the user logging into the browser is confirmed.

8. An electronic device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 5.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Resource data page identification method and device based on uniform resource locator

    CN110851801A

  • Method and system for adding watermarks to online preview of document based on browser

    CN113704708A

  • Method and device for generating application page watermark and computer equipment

    CN117076003A